blob: 507a9a629208c0343d2d438ca44541ed74f33110 (
plain)
- #!/bin/sh
- #
- # /usr/local/sbin/adduser.local
- # Copyright 2001-2002 Jonas Smedegaard <dr@jones.dk>
- #
- # $Id: adduser.local,v 1.6 2002-03-07 16:22:51 jonas Exp $
- #
- # Common adduser additions for Spiff and Xenux networks
- #
- set -e
- NEWUSERNAME=$1
- NEWUID=$2
- NEWGID=$3
- NEWHOMEDIR=$4
- . /etc/adduser.conf
- # Ignore non-human accounts silently
- [ "$NEWUID" -ge "$FIRST_UID" -a "$NEWUID" -le "$LAST_UID" ] || exit 0
- [ -f /etc/local/users.conf ] && . /etc/local/users.conf
- # 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 $NEWUSERNAME $mailforward
- ;;
- ?*)
- echo "That wasn't a proper email address - skipping..."
- ;;
- esac
- ;;
- esac
- fi
- # Mailing lists
- #FIXME: Be more generic - support other mailinglists than mailman!
- 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
- if [ -f /etc/local/users.conf ]; then
- . /etc/local/users.conf
- if [ -n "$USERS_GROUPNAME" ]; then
- addgroup $NEWUSERNAME $USERS_GROUPNAME
- fi
- if [ -n "$REALUSERS_GROUPNAME" ]; then
- echo "This system has both dummy and real users:"
- echo " Dummy users have read access to specific files."
- echo " Real users have read/write access to personal files."
- echo -n "Is this a dummy user (Y/n)? "
- read realuser
- case $realuser in
- y|Y|"")
- ;;
- *)
- addgroup $NEWUSERNAME $REALUSERS_GROUPNAME
- ;;
- esac
- fi
- fi
- if [ -x /usr/local/sbin/user-init ]; then
- /usr/local/sbin/user-init $NEWUSERNAME
- fi
|