#! /bin/sh -e
-# Install keychain xauth x11-xserver-utils in the chroot first.
+
+# Chroot preparation:
+# locale-gen en_GB.UTF-8
+# apt-get --no-install-recommends install keychain xauth x11-xserver-utils
+# adduser --disabled-password cjwatson
+# addgroup --system admin
+# adduser cjwatson admin
+# visudo # add '%admin ALL=(ALL) ALL'
+
if [ -e "$1/proc/cmdline" ]; then exit; fi
ensure_dir_mine () {
ensure_dir_mine "$1/home/cjwatson/.keychain"
sudo mount --bind /home/cjwatson/.keychain "$1/home/cjwatson/.keychain"
fi
-xauth list | sudo chroot "$1" su cjwatson -c 'xargs -l1 xauth add'
+xauth list | sudo chroot "$1" su cjwatson -c 'xargs -l1 xauth add' || true
rm -f "$1/home/cjwatson/.ICEauthority"
iceauth list | sudo chroot "$1" su cjwatson -c 'xargs -l1 iceauth add'
sudo cp -a /etc/resolv.conf "$1/etc/"