X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=remove-user.sh;h=1b683e0bab670b950dfc8fda1376f40d39aefc99;hb=e8bca9ec3bc5683221540586893bdc155c0fe3b6;hp=eedbd363418a9183773ae177b4ae68044dfa6451;hpb=5c22ab2319eeec21a0b374a149aac48b2ca6ff13;p=cloudstore.git diff --git a/remove-user.sh b/remove-user.sh index eedbd36..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 -Rv 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 {} \;