$ curl -O http://cvs.sakaiproject.org/release/1.0.0/src/sakai_quickstart.zip


!/bin/sh

# Script to CREATE new teacher site
# Run AS ROOT from anywhere

clear

# nireport / /users name uid | grep "[0123456789][0123456789]"
# nireport . /users uid name | sort -n
# nireport . /users uid name realname home | sort -n
nireport . /users uid name realname | sort -n

echo "**************************"
echo "Creating a new web account"
echo "**************************"
echo " "
echo "Read the information above to get next available UID#"
echo " "
# echo "Using UID# 1701 and above starting Fall 2004"
# echo " "


if [ "$1" = "" ]; then
        printf "Enter Instructor Login Name "
        read loginname
if [ "$loginname" = "" ]; then
   echo "Sorry, you must enter an instructor login name"
   echo " "
exit
 else

# echo "You entered $loginname"
echo " "
 fi
fi

niutil -create / /users/$loginname

if [ "$2" = "" ]; then
        printf "Enter UID # "
        read uid
 if [ "$uid" = "" ]; then
   echo "Sorry, you must enter a unique UID#"
echo " "
   exit
 else

# echo "You entered $uid"
echo " "
 fi
fi

niutil -createprop / /users/$loginname uid "$uid"

if [ "$3" = "" ]; then
        printf "Enter REAL Instructor Name, FIRST and LAST "
        read realname
 if [ "$realname" = "" ]; then
   echo "Sorry, you must enter a Real Instructor Name"
echo " "
   exit
 else
   
# echo "You entered $realname"
echo " "
 fi
fi

niutil -createprop / /users/$loginname realname "$realname"
niutil -createprop / /users/$loginname home "/Users/$loginname"
niutil -createprop / /users/$loginname shell "/bin/tcsh"
niutil -createprop / /users/$loginname gid 20

niutil -createprop / /users/$loginname passwd "*"
passwd $loginname
cp -R /System/Library/User\ Template/English.lproj /Users/$loginname
chown -R $loginname:staff /Users/$loginname
 
# REMOVE EXTRA DIRECTORIES

rm -R /Users/$loginname/D*
rm -R /Users/$loginname/L*
rm -R /Users/$loginname/M*
rm -R /Users/$loginname/P*
rm -R /Users/$loginname/Sites/Streaming
   
echo " "
echo "Finished setting user account for $loginname"
echo " "
echo "You need to add an ALIAS to the http.conf/sites/0000 file"
echo " "
        
printf "Should we go there now? y/n [Y] "
        read gotherenow
   
if [ "$gotherenow" = "n" ]; then
        echo "Okay, but remember to add the alias for $loginname"
else
        pico /etc/httpd/sites/0000_10.200.0.27_80_teach.lanecc.edu.conf
        apachectl graceful
        echo "Alias successfully added"
fi 
  
echo " "
echo "Account has been set up for $realname"

