#!/bin/sh
#
# Create the junk for a new user.
#
NEWUSER=$1
GROUP=$2

if [ X${GROUP} = "X" ] ; then
	echo Use: NEWUSER username group
	exit
fi

echo "Creating home directory"
mkdir ${NEWUSER}
chown ${NEWUSER}.${GROUP} ${NEWUSER}

echo "Copying in template files from nobody"
cp -R nobody/* ${NEWUSER}
cp -R nobody/.* ${NEWUSER}
cd ${NEWUSER}
ln -s .bashrc .bash_profile

echo "Creating a link to the library"
ln -s /u/library library

chown -fR ${NEWUSER}.${GROUP} *
chown -fR ${NEWUSER}.${GROUP} .[a-z]* 
chown -fR ${NEWUSER}.${GROUP} .[A-Z]* 

echo "Creating empty inbox"
cp /dev/null /var/mail/${NEWUSER}
chown ${NEWUSER}.${GROUP} /var/mail/${NEWUSER}

echo Setting up for PGP
cd /u
. NEWPGP ${NEWUSER} ${GROUP}

echo "Don't forget to edit ${NEWUSER}/.elm/elmrc"

