Add smart chroot script
Add smart chroot script

I want to be able to enter a chroot environment to change the base OS I am
using (not to restrict my environment) as easily and painlessly as possible.

This schroot script:
 - re-runs itself with sudo if it was run as a limited user
 - bind mounts /home, /proc, /sys and /dev into the chroot
 - Bind mounts the original root to /orig_root
 - copies /etc/resolv.conf into the chroot
 - Sets the hostname in the chroot to match the host, and updates /etc/hosts
 - Copies the current user into /etc/passwd and /etc/shadow
 - Grants the user sudo access in the chroot
 - Sets a distinctive prompt to indicate we are in the chroot
 - Enters the chroot as the current user (or root with -r)
 - Is intelligent enough that setup and cleanup is only done if the chroot is
   not otherwise in use (so it is safe to run the command multiple times from
   different shells and be able to close them in any order).  (User setup is
   done every time, in case we have entered it as different users, such as
   root and the current user).

Signed-off-by: Ian Munsie <ce389fd2fa887d610219cb85dea6dc9451973e74@gmail.com>

DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk