summaryrefslogtreecommitdiff
path: root/deluser.local
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2002-02-25 04:29:11 +0000
committerJonas Smedegaard <dr@jones.dk>2002-02-25 04:29:11 +0000
commitd1b62e048b3a390a5565bdd2ecaaf15d8e46d660 (patch)
tree95576537a364d30e3f6ed8fd2be4f6d878501e44 /deluser.local
parentd9343ef8fa935e8e10f6b275219343bdf793e3df (diff)
A few more tweaks and corrections to adduser.local, deluser.local and user-init.
Diffstat (limited to 'deluser.local')
-rwxr-xr-xdeluser.local49
1 files changed, 30 insertions, 19 deletions
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