summaryrefslogtreecommitdiff
path: root/adduser.local
blob: 6c8dfbb41f23bb6dcc3f97e73ccaed945bc268f2 (plain)
  1. #!/bin/sh
  2. set -e
  3. NEWUSERNAME=$1
  4. NEWUID=$2
  5. NEWGID=$3
  6. NEWHOMEDIR=$4
  7. [ "x$NEWHOMEDIR" = "x/home/$NEWUSERNAME" ] || exit 0
  8. #su $1 -c 'echo "$realuser\@$host">~/.forward'
  9. addgroup $NEWUSERNAME users
  10. if [ -x /usr/local/sbin/user-init ]; then
  11. /usr/local/sbin/user-init $NEWUSERNAME
  12. fi
  13. # Samba password
  14. #FIXME: Check if enabled in samba.conf (or included files!)
  15. if [ -x /usr/local/sbin/smbadduser -a -f /etc/samba/smbpasswd -a -x /bin/csh ]; then
  16. /usr/local/sbin/smbadduser $NEWUSERNAME:$NEWUSERNAME
  17. fi
  18. # Mail forwarding
  19. #FIXME: Do some syntax checking and bail out with a warning if something wrong
  20. if [ -x /usr/local/sbin/userforward ]; then
  21. echo -n "Forward mail to which account (leave blank to ignore)? "
  22. read -s mailforward
  23. echo
  24. case $mailforward in
  25. y|Y)
  26. /usr/local/sbin/userforward $1 $mailforward
  27. esac
  28. fi
  29. # Mailing lists
  30. listdir="/var/lib/mailman/lists"
  31. lists=""
  32. [ -d $listdir ] && \
  33. lists=`find $listdir -type d -mindepth 1 -maxdepth 1 -exec basename '{}' \;`
  34. for list in $lists; do
  35. if [ -d $listdir/$list -a -x /usr/sbin/add_members ]; then
  36. echo -n "Subscribe to mailinglist $list (y/N)? "
  37. read -s subscribe
  38. echo
  39. case $subscribe in
  40. y|Y)
  41. /bin/echo $NEWUSERNAME@`/bin/dnsdomainname` \
  42. | /usr/sbin/add_members -n - users
  43. ;;
  44. esac
  45. fi
  46. done
  47. #FIXME: Make this ALOT more generic (or move it to /etc/local/adduser.d)!
  48. if [ -d /home/christof/ftp_christof_ro ]; then
  49. echo "Real users have read/write access to personal files."
  50. echo "Dummy users have read access to published files."
  51. echo -n "Is this a *real* user (y/N)? "
  52. read -s realuser
  53. echo
  54. case $realuser in
  55. y|Y)
  56. addgroup $NEWUSERNAME realusers
  57. ;;
  58. *)
  59. [ -e /home/christof/ftp_christof_ro/$1 ] \
  60. || mkdir /home/christof/ftp_christof_ro/$1
  61. chown christof: /home/christof/ftp_christof_ro/$1
  62. chmod u=rw,go=r,a+X /home/christof/ftp_christof_ro/$1
  63. ln -s /home/christof/ftp_christof_ro/$1 $4/images
  64. ;;
  65. esac
  66. fi