Re: [Server-devel] XS backup/restore feature

2009-08-04 Thread Daniel Drake
Here are new, tested versions of the backup/restore scripts.

They are more robust (not using temporary disk space any more), which
has a small speed penalty but should improve reliability and decrease
disk space requirements.

xs-backup now has a --uncompressed option which produces an un-gzipped
version suitable for rsync or similar.

could these be included in xs-tools? :)

cheers
Daniel


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


[Server-devel] XS backup/restore feature

2009-07-29 Thread Daniel Drake
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


Re: [Server-devel] XS backup/restore feature

2009-07-29 Thread Martin Langhoff
On Thu, Jul 30, 2009 at 3:55 AM, Sameer Vermasve...@sfsu.edu wrote:
 tar --numeric-owner should work, right?

heh! no no, the reverse. What tar does is fantastic, and saves us a
lot of work. I *thought* tar could only store numeric uids/gids and
that we'd have to write code to keep them in sync.

Sorry about the confusion.

cheers,


m

-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel