[Commits] idmgr branch master updated.
Martin Langhoff
martin at laptop.org
Wed Aug 19 11:35:20 EDT 2009
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "/home/olpc-code/git/projects/idmgr".
The branch, master has been updated
via 60cece96912646df1dc446150f8b266338143b14 (commit)
from 7480458321745e677edf51302dd35ec316a79bf6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
scripts/create_user | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 60cece96912646df1dc446150f8b266338143b14
Author: Martin Langhoff <martin at laptop.org>
Date: Wed Aug 19 17:34:43 2009 +0200
create_user: better support for use by xs-restore
- patch by Daniel Drake
diff --git a/scripts/create_user b/scripts/create_user
index ecd9570..4e1a898 100755
--- a/scripts/create_user
+++ b/scripts/create_user
@@ -37,16 +37,26 @@ die() {
exit 1
}
+PASSWD_ONLY=0
+# this option allows the homedir setup (including dealings with ssh key)
+# to be skipped. useful when restoring from backups.
+if [ '$1' == '--passwd-only' ]; then
+ PASSWD_ONLY=1
+fi
+
read username
read full_name
-read uuid #unused!
-read pubkey
+if [ '$PASSWD_ONLY' == '0' ]; then
+ read uuid #unused!
+ read pubkey
+fi
# check for sane values
export LC_ALL=C
echo "$username" | grep -s -E '^[A-Z]{3}[A-F0-9]{8}$' &> /dev/null || die "bad username"
-echo "$pubkey" | grep -s -E '^[A-Za-z0-9+/=]+$' &> /dev/null || die "bad public key"
-
+if [ '$PASSWD_ONLY' == '0' ]; then
+ echo "$pubkey" | grep -s -E '^[A-Za-z0-9+/=]+$' &> /dev/null || die "bad public key"
+fi
homedir=/library/users/$username
XO_USERS_GROUP=xousers
@@ -68,6 +78,8 @@ else
NEW_USER=1
fi
+[ '$PASSWD_ONLY' == '1' ] && exit 0
+
#from here, if a new user was created, a failure will leave the user
#there but unconfigured. So rather than simply dying, we try to clean
#up first.
@@ -90,4 +102,4 @@ echo "ssh-dss $pubkey" >> .ssh/authorized_keys || clean_up_and_die "Unable to se
chmod 600 .ssh/authorized_keys || clean_up_and_die "Unable to chmod authorized_keys"
chown -R $username .ssh || clean_up_and_die "Unable to chown .ssh"
-#clean_up_and_die goodbye
\ No newline at end of file
+#clean_up_and_die goodbye
-----------------------------------------------------------------------
--
/home/olpc-code/git/projects/idmgr
More information about the Commits
mailing list