summaryrefslogtreecommitdiff
path: root/adduser.local
blob: e946bf5424b93d3a3af3994b3fe52bec82d48b9c (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. if [ -x /usr/local/sbin/userforward ]; then
  20. echo -n "Forward mail to an external account (y/N)? "
  21. read mailforward
  22. case $mailforward in
  23. y|Y)
  24. echo -n "Enter external email address: "
  25. read mail_address
  26. case $mail_address in
  27. ?*@?*.*)
  28. /usr/local/sbin/userforward $1 $mailforward
  29. ;;
  30. ?*)
  31. echo "That wasn't a proper email address - skipping..."
  32. ;;
  33. esac
  34. ;;
  35. esac
  36. fi
  37. # Mailing lists
  38. listdir="/var/lib/mailman/lists"
  39. lists=""
  40. [ -d $listdir ] && \
  41. lists=`find $listdir -type d -mindepth 1 -maxdepth 1 -exec basename '{}' \;`
  42. for list in $lists; do
  43. if [ -d $listdir/$list -a -x /usr/sbin/add_members ]; then
  44. echo -n "Subscribe to mailinglist $list (y/N)? "
  45. read subscribe
  46. case $subscribe in
  47. y|Y)
  48. /bin/echo $NEWUSERNAME@`/bin/dnsdomainname` \
  49. | /usr/sbin/add_members -n - users
  50. ;;
  51. esac
  52. fi
  53. done
  54. #FIXME: Make this ALOT more generic (or move it to /etc/local/adduser.d)!
  55. if [ -d /home/christof/ftp_christof_ro ]; then
  56. echo "This seems to be a dummy/real user environment:"
  57. echo " Real users have read/write access to personal files."
  58. echo " Dummy users have read access to published files."
  59. echo -n "Is this a *real* user (y/N)? "
  60. read realuser
  61. case $realuser in
  62. y|Y)
  63. addgroup $NEWUSERNAME realusers
  64. ;;
  65. *)
  66. [ -e /home/christof/ftp_christof_ro/$1 ] \
  67. || mkdir /home/christof/ftp_christof_ro/$1
  68. chown christof: /home/christof/ftp_christof_ro/$1
  69. chmod u=rw,go=r,a+X /home/christof/ftp_christof_ro/$1
  70. if [ -e $4/images ]; then
  71. if [ -L $4/images ]; then
  72. rm -rf $4/images
  73. ln -s /home/christof/ftp_christof_ro/$1 $4/images
  74. else
  75. echo "Something is wrong - $4/images exists already."
  76. echo "This maybe isn't a dummy/real environment after all. Bailing out..."
  77. fi
  78. else
  79. ln -s /home/christof/ftp_christof_ro/$1 $4/images
  80. fi
  81. ;;
  82. esac
  83. fi