Re: Chroot woody setup in 15 minutes
Quoting Adam Heath <adam@doogie.org>:
>
> Once you get the chroot configured with apt, the following script is helpful
> to automate the above(allows for easy start/stop, and keeps the chroot in a
> semi-updated state with the host).
Works wonderfully well, except that $dir is chroot/etc/init.d
rather than just chroot. So I hacked a /../.. onto the end of dir.
> ---
> #!/bin/sh -e
> if [ -e /etc/init.d/$(basename $0) ]; then
> # starting inside chroot
> hostname -F /etc/hostname
> exec /bin/sh --login
> else
> # starting outside the chroot
> dir=$(dirname $0)
^-- append /../..
> files="/etc/resolv.conf /etc/hosts /etc/hostname"
> for f in $files; do
> cp $f $dir/$f
> done
> mount proc -t proc $dir/proc
> chroot $dir /etc/init.d/$(basename $0)
> umount $dir/proc
> fi
> ---
Thanks,
Andrew Stribblehill
Reply to: