c8dbe71d6d90cfd74854ffe0cc1f63369a4f4fa4
[easy-deb-chroot] / fremantle / easy-chroot / .py2deb_build_folder / easy-chroot / src / sbin / synchroot
1 #!/bin/sh
2 #Synch a mounted chroot; this means copying some important files to the chroot.
3
4 #Try to get the chroot location from the config file... 
5 if [ "x$CHROOT" = x ] ; then
6   #Pull in the config, if possible...
7   [ -f /home/user/.chroot ] && . /home/user/.chroot
8   #Still not set? Set to default
9   [ "x$CHROOT" != x ] || CHROOT=/debian
10 fi
11
12 #Abort if chroot not mounted.
13 if [ ! -d "$CHROOT/etc/" ] ; then
14   echo "cannot sync; chroot not mounted!"
15   exit 99
16 fi
17
18 echo "synching the chroot..."
19
20 #Just a somewhat-readable uniquifier so backups don't overwrite other backups.
21 BOB=`date | awk '{print $1$2$3}'`
22
23 #Make the Internet work.
24
25 mv "$CHROOT/etc/resolv.conf" "$CHROOT/etc/resolv.conf.$BOB"
26 cp /etc/resolv.conf "$CHROOT/etc/resolv.conf"
27 mv "$CHROOT/etc/hosts" "$CHROOT/etc/hosts.$BOB"
28 cp /etc/hosts "$CHROOT/etc/hosts"
29
30 #Make permissions work.
31 mv "$CHROOT/etc/group" "$CHROOT/etc/group.$BOB"
32 cp /etc/group "$CHROOT/etc/group"
33 mv "$CHROOT/etc/passwd" "$CHROOT/etc/passwd.$BOB"
34 cp /etc/passwd "$CHROOT/etc/passwd"
35
36 #Set the correct time.
37 mv "$CHROOT/etc/localtime" "$CHROOT/etc/localtime.$BOB"
38 cp -a /etc/localtime "$CHROOT/etc/localtime"
39
40 #Help make N810 F-keys work
41 mv "$CHROOT/usr/share/X11/xkb" "$CHROOT/usr/share/X11/xkb.$BOB"
42 cp -r /usr/share/X11/xkb "$CHROOT/usr/share/X11"