Hi Martin,
Any interest in adding functionality to the XS to back up and restore user data?
Including:
- stuff that has been posted on moodle
- XO backups
- registration information
but *not* stuff where deployments should always have a master copy elsewhere:
- activities from activity server
- OS images in xs-rsync
- system files
- ...
Here's an initial implementation, which can be used to create a
single-file compressed backup which can then be copied to an external
storage device.
Backup part has been tested, but not restore just yet. Needs a patch
to idmgr create_user too. What do you think?
Daniel
--- create_user.orig 2009-07-29 15:55:26.0 +0545
+++ create_user 2009-07-29 15:54:19.0 +0545
@@ -37,16 +37,26 @@
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 @@
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 @@
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 hay ningún carácter de nueva línea al final del fichero
+#clean_up_and_die goodbye
xs-backup
Description: Binary data
xs-restore
Description: Binary data
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel