blob: e946bf5424b93d3a3af3994b3fe52bec82d48b9c (
plain)
- #!/bin/sh
- set -e
- NEWUSERNAME=$1
- NEWUID=$2
- NEWGID=$3
- NEWHOMEDIR=$4
- [ "x$NEWHOMEDIR" = "x/home/$NEWUSERNAME" ] || exit 0
- #su $1 -c 'echo "$realuser\@$host">~/.forward'
- addgroup $NEWUSERNAME users
- if [ -x /usr/local/sbin/user-init ]; then
- /usr/local/sbin/user-init $NEWUSERNAME
- fi
- # Samba password
- #FIXME: Check if enabled in samba.conf (or included files!)
- if [ -x /usr/local/sbin/smbadduser -a -f /etc/samba/smbpasswd -a -x /bin/csh ]; then
- /usr/local/sbin/smbadduser $NEWUSERNAME:$NEWUSERNAME
- fi
- # Mail forwarding
- if [ -x /usr/local/sbin/userforward ]; then
- echo -n "Forward mail to an external account (y/N)? "
- read mailforward
- case $mailforward in
- y|Y)
- echo -n "Enter external email address: "
- read mail_address
- case $mail_address in
- ?*@?*.*)
- /usr/local/sbin/userforward $1 $mailforward
- ;;
- ?*)
- echo "That wasn't a proper email address - skipping..."
- ;;
- esac
- ;;
- esac
- fi
- # Mailing lists
- listdir="/var/lib/mailman/lists"
- lists=""
- [ -d $listdir ] && \
- lists=`find $listdir -type d -mindepth 1 -maxdepth 1 -exec basename '{}' \;`
- for list in $lists; do
- if [ -d $listdir/$list -a -x /usr/sbin/add_members ]; then
- echo -n "Subscribe to mailinglist $list (y/N)? "
- read subscribe
- case $subscribe in
- y|Y)
- /bin/echo $NEWUSERNAME@`/bin/dnsdomainname` \
- | /usr/sbin/add_members -n - users
- ;;
- esac
- fi
- done
- #FIXME: Make this ALOT more generic (or move it to /etc/local/adduser.d)!
- if [ -d /home/christof/ftp_christof_ro ]; then
- echo "This seems to be a dummy/real user environment:"
- echo " Real users have read/write access to personal files."
- echo " Dummy users have read access to published files."
- echo -n "Is this a *real* user (y/N)? "
- read realuser
- case $realuser in
- y|Y)
- addgroup $NEWUSERNAME realusers
- ;;
- *)
- [ -e /home/christof/ftp_christof_ro/$1 ] \
- || mkdir /home/christof/ftp_christof_ro/$1
- chown christof: /home/christof/ftp_christof_ro/$1
- chmod u=rw,go=r,a+X /home/christof/ftp_christof_ro/$1
- if [ -e $4/images ]; then
- if [ -L $4/images ]; then
- rm -rf $4/images
- ln -s /home/christof/ftp_christof_ro/$1 $4/images
- else
- echo "Something is wrong - $4/images exists already."
- echo "This maybe isn't a dummy/real environment after all. Bailing out..."
- fi
- else
- ln -s /home/christof/ftp_christof_ro/$1 $4/images
- fi
- ;;
- esac
- fi
|