2 # Sets up (if necessary) for chroot into a Debian environment.
3 # Expects root privileges, does not drop them.
4 # Look to /usr/bin/debbie-sue for a friendly wrapper.
6 # By Alan M Bruce (qole)
7 # with help from Benson Mitchell, Thomas Perl, Anton Rebhan
9 # GPL licensed; keep code free!
11 if [ "`whoami`" != "root" ] ; then
12 echo "please run me as root!"
16 #Pull in the config, if possible...
17 if [ -f "/home/user/.chroot" ] ; then
22 echo "No ~/.chroot file." >/dev/stderr
25 #This comes from the config file... If not, fall back on '/debian'
26 if [ "x$CHROOT" = "x" ] ; then
28 echo "No chroot dir specified; using $CHROOT" >/dev/stderr
30 echo "Chroot dir specified: $CHROOT" >/dev/stderr
33 #This comes from the config. If not, search for debian*.img.ext2
34 if [ "x$IMGFILE" = "x" ] ; then
35 echo "No image file or partition specified." >/dev/stderr
36 IMGMMC="`ls -1 /home/user/MyDocs/debian*.img* /media/mmc1/debian*.img* | head -1`"
37 if [ "x$IMGMMC" != x ] ; then
40 MSG1=`printf "ERROR!\n\nYou have no debian.img.ext2 file on your memory cards.\n\nPlease use the Debian Image Installer in Extras."`
41 if [ ! -f "/usr/bin/gxmessage" ] ; then
42 echo $MSG1 >/dev/stderr
44 gxmessage -center -alignbuttons center -buttons GTK_STOCK_OK:0 -geometry 680x250 -title "MISSING DISK IMAGE" "$MSG1"
49 echo "$IMGFILE specified in ~/.chroot" >/dev/stderr
53 #Make the temp dir bigger for OpenOffice etc.
55 #This comes from the config file...
56 #If not, fall back to a 6MB /tmp dir
59 [ "x$TMPSIZE" != x ] || TMPSIZE=6M
60 mount -o remount,size=$TMPSIZE /tmp
62 # All exported variables need to be defined in the chroot with this script.
64 qchroot $IMGFILE $CHROOT su - "$@"