#!/bin/sh
echo "******************"
echo "Type the user who will be making the kernel"
read un
id=`id $un | nawk -F'[=(]' '{print $2}'`
echo "predicate someuser(a of Agent) = (a.userid == \"$id\");" > policy/user.policy
echo "Changing permissions for /usr/src/sys .. be sure to run bin/end_demo to"
echo "fix this later!!"
chown -R $un /usr/src/sys
echo "Adding files to policy... stand by, this could take a long time."
bin/prepepl /sys/ > policy/files.policy 
echo "Creating policy file... this will take a REALLY long time."
bin/pepl policy/files.policy policy/kernel.policy policy/user.policy policy/network.policy > /dev/null 2>&1
echo "Making executables..."
cd driver
make > /dev/null 2>&1
mknod -m a=rw /dev/policy c 29 0 > /dev/null 2>&1
cd ..
cd pdp
make  > /dev/null 2>&1
cd ..
echo "Done!  Now, just run bin/start_demo"
echo "******************"