user_info($login|$uid)
[cloudstore.git] / create-user.sh
index 52bd56b..56c9459 100755 (executable)
@@ -14,17 +14,16 @@ fi
 test -z "$quota" && quota=200k
 
 if passwd=`grep ":$email:" /var/lib/extrausers/passwd` ; then
-       echo "## $passwd"
+       echo "## $passwd" 1>&2
        uid=`echo $passwd | cut -d: -f3`
 else
        uid=`tail -1 /var/lib/extrausers/passwd | cut -d: -f3`
-       echo $uid
+       echo "## last uid: $uid" 1>&2
        uid=`expr $uid + 1`
        echo "u$uid:$password:$uid:$PORT:$email:$SLICE/$uid:/bin/false" \
                >> /var/lib/extrausers/passwd
 fi
 
-ZSLICE=`echo $SLICE | sed 's!^/!!'`
 if [ ! -e $SLICE/$uid ] ; then
        mkdir $SLICE/$uid
        chown $uid:$PORT $SLICE/$uid
@@ -32,12 +31,14 @@ if [ ! -e $SLICE/$uid ] ; then
 fi
 
 secrets="$SLICE/$uid/.secrets"
-grep "^u$uid:" $secrets || echo "u$uid:$password" >> $secrets
+grep "^u$uid:" $secrets 1>&2 || echo "u$uid:$password" >> $secrets
 md5mail=`echo -n $email | md5sum | cut -d" " -f1`
 md5passwd=`echo -n $password | md5sum | cut -d" " -f1`
-grep "^$md5mail:" $secrets || echo "$md5mail:$md5passwd" >> $secrets
+grep "^$md5mail:" $secrets 1>&2 || echo "$md5mail:$md5passwd" >> $secrets
 
-id u$uid
-zfs get userquota@u$uid $ZSLICE
-zfs get userused@u$uid $ZSLICE
-cat $secrets
+id u$uid 1>&2
+zfs get userquota@u$uid $ZSLICE 1>&2
+zfs get userused@u$uid $ZSLICE 1>&2
+cat $secrets 1>&2
+
+echo "u$uid"