From d1b62e048b3a390a5565bdd2ecaaf15d8e46d660 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 25 Feb 2002 04:29:11 +0000 Subject: A few more tweaks and corrections to adduser.local, deluser.local and user-init. --- deluser.local | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'deluser.local') diff --git a/deluser.local b/deluser.local index e037fd1..77c68ec 100755 --- a/deluser.local +++ b/deluser.local @@ -5,10 +5,25 @@ OLDUID=$2 OLDGID=$3 OLDHOMEDIR=$4 +. /etc/adduser.conf + +#. /etc/deluser.conf +# Workaround: default deluser.conf is not sh-compatible (like adduser.conf) +REMOVE_HOME=`grep REMOVE_HOME /etc/deluser.conf | awk -F= '{print $2}' | head -1 | sed 's/^ //g'` + +# Ignore non-human accounts silently +[ "$OLDUID" -ge "$FIRST_UID" -a "$OLDUID" -le "$LAST_UID" ] || exit 0 + +[ -f /etc/local/users.conf ] && . /etc/local/users.conf + +# Samba password if [ -e /etc/samba/smbpasswd -a -x /usr/bin/smbpasswd ]; then /usr/bin/smbpasswd -x $OLDUSERNAME || true fi +#TODO: Netatalk password + +# Mailinglists if [ -x /usr/sbin/remove_members ]; then if [ -d /var/lib/mailman/lists/users ]; then /bin/echo $OLDUSERNAME@`/bin/dnsdomainname` \ @@ -20,25 +35,21 @@ if [ -x /usr/sbin/remove_members ]; then fi fi -#FIXME: Make this ALOT more generic! -if [ -d /home/christof/ftp_christof_ro/$1 -a -n "$1" ]; then - echo -n "It seems this was a dummy user. Remove shared files (y/N)? " - read remove_files - case $remove_files in - y|Y) - rm -rf /home/christof/ftp_christof_ro/$1 - ;; - esac +# Check for dummy shared files if enabled in /etc/local/users.conf +if [ -n "$DUMMYSHAREDDIR" ]; then + if [ -d $DUMMYSHAREDDIR/$OLDUSERNAME -a -n "$OLDUSERNAME" ]; then + echo -n "It seems this was a dummy user. Remove shared files (y/N)? " + read remove_files + case $remove_files in + y|Y) + rm -rf $DUMMYSHAREDDIR/$OLDUSERNAME + ;; + esac + fi fi -# It seems deluser doesn't always remove home even if told to do so -#FIXME: Only ask (or default to yes, or both) if removing is enabling in /etc/deluser.conf -if [ -d $4 -a -n "$4" ]; then - echo -n "Remove old home (y/N)? " - read remove_home - case $remove_home in - y|Y) - rm -rf $4 - ;; - esac +# Workaround: It seems deluser avoids symlinks when told to remove homedir +if [ "$REMOVE_HOME" -a -d $OLDHOMEDIR ]; then + echo "Removing $OLDHOMEDIR..." + rm -rf $OLDHOMEDIR fi -- cgit v1.2.3