Easy Chroot 0.3.1
[easy-deb-chroot] / fremantle / easy-chroot / .py2deb_build_folder / easy-chroot / src / sbin / synchroot
diff --git a/fremantle/easy-chroot/.py2deb_build_folder/easy-chroot/src/sbin/synchroot b/fremantle/easy-chroot/.py2deb_build_folder/easy-chroot/src/sbin/synchroot
new file mode 100755 (executable)
index 0000000..c8dbe71
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+#Synch a mounted chroot; this means copying some important files to the chroot.
+
+#Try to get the chroot location from the config file... 
+if [ "x$CHROOT" = x ] ; then
+  #Pull in the config, if possible...
+  [ -f /home/user/.chroot ] && . /home/user/.chroot
+  #Still not set? Set to default
+  [ "x$CHROOT" != x ] || CHROOT=/debian
+fi
+
+#Abort if chroot not mounted.
+if [ ! -d "$CHROOT/etc/" ] ; then
+  echo "cannot sync; chroot not mounted!"
+  exit 99
+fi
+
+echo "synching the chroot..."
+
+#Just a somewhat-readable uniquifier so backups don't overwrite other backups.
+BOB=`date | awk '{print $1$2$3}'`
+
+#Make the Internet work.
+
+mv "$CHROOT/etc/resolv.conf" "$CHROOT/etc/resolv.conf.$BOB"
+cp /etc/resolv.conf "$CHROOT/etc/resolv.conf"
+mv "$CHROOT/etc/hosts" "$CHROOT/etc/hosts.$BOB"
+cp /etc/hosts "$CHROOT/etc/hosts"
+
+#Make permissions work.
+mv "$CHROOT/etc/group" "$CHROOT/etc/group.$BOB"
+cp /etc/group "$CHROOT/etc/group"
+mv "$CHROOT/etc/passwd" "$CHROOT/etc/passwd.$BOB"
+cp /etc/passwd "$CHROOT/etc/passwd"
+
+#Set the correct time.
+mv "$CHROOT/etc/localtime" "$CHROOT/etc/localtime.$BOB"
+cp -a /etc/localtime "$CHROOT/etc/localtime"
+
+#Help make N810 F-keys work
+mv "$CHROOT/usr/share/X11/xkb" "$CHROOT/usr/share/X11/xkb.$BOB"
+cp -r /usr/share/X11/xkb "$CHROOT/usr/share/X11"
\ No newline at end of file