X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=remove-user.sh;h=1b683e0bab670b950dfc8fda1376f40d39aefc99;hb=925ecfc00ce5ab771ff4337fcb9f1b27dc9570cb;hp=f2197f4eb0e97582d6805e3d928b91b94ab566a5;hpb=cc94c9ba6e9bb5767437846c969a77d139082208;p=cloudstore.git diff --git a/remove-user.sh b/remove-user.sh index f2197f4..1b683e0 100755 --- a/remove-user.sh +++ b/remove-user.sh @@ -1,10 +1,18 @@ #!/bin/sh -xe -login=$1 +. ./env.sh -if [ -z "$login" ]; then - ls -al users/ +email=$1 +passwd=/var/lib/extrausers/passwd + +if [ -z "$email" ]; then + cat $passwd | cut -d: -f5 exit 1 fi -rm -Rvf users/$login +if dir=`grep ":$email:" $passwd | cut -d: -f6` ; then + rm -Rfv $dir + grep -v ":$email:" $passwd > $passwd.new && mv $passwd.new $passwd +fi + +find $SLICE/md5/ -links 1 -exec rm -fv {} \;