X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=fremantle%2Feasy-deb-chroot%2Fsrc%2Fsbin%2Fdebsu;fp=fremantle%2Feasy-deb-chroot%2Fsrc%2Fsbin%2Fdebsu;h=e4f178543e81c94232ffd01284076b8560c98037;hb=d17ba37c01c5014a82c318b8dfeb09bd27cf209b;hp=0000000000000000000000000000000000000000;hpb=af7fe7476a5e0a0bdb128020fe30522b15c070e7;p=easy-deb-chroot diff --git a/fremantle/easy-deb-chroot/src/sbin/debsu b/fremantle/easy-deb-chroot/src/sbin/debsu new file mode 100755 index 0000000..e4f1785 --- /dev/null +++ b/fremantle/easy-deb-chroot/src/sbin/debsu @@ -0,0 +1,64 @@ +#!/bin/sh +# Sets up (if necessary) for chroot into a Debian environment. +# Expects root privileges, does not drop them. +# Look to /usr/bin/debbie-sue for a friendly wrapper. + +# By Alan M Bruce (qole) +# with help from Benson Mitchell, Thomas Perl, Anton Rebhan +# +# GPL licensed; keep code free! + +if [ "`whoami`" != "root" ] ; then + echo "please run me as root!" + exit 9 +fi + +#Pull in the config, if possible... +if [ -f "/home/user/.chroot" ] ; then + +. /home/user/.chroot + +else + echo "No ~/.chroot file." >/dev/stderr +fi + +#This comes from the config file... If not, fall back on '/debian' +if [ "x$CHROOT" = "x" ] ; then + CHROOT=/.debian + echo "No chroot dir specified; using $CHROOT" >/dev/stderr +else + echo "Chroot dir specified: $CHROOT" >/dev/stderr +fi + +#This comes from the config. If not, search for debian*.img.ext2 +if [ "x$IMGFILE" = "x" ] ; then + echo "No image file or partition specified." >/dev/stderr + IMGMMC="`ls -1 /home/user/MyDocs/debian*.img* /media/mmc1/debian*.img* | head -1`" + if [ "x$IMGMMC" != x ] ; then + IMGFILE="$IMGMMC" + else + MSG1=`printf "ERROR!\n\nYou have no debian.img.ext2 file on your memory cards.\n\nPlease use the Debian Image Installer in Extras."` + if [ ! -f "/usr/bin/gxmessage" ] ; then + echo $MSG1 >/dev/stderr + else + gxmessage -center -alignbuttons center -buttons GTK_STOCK_OK:0 -geometry 680x250 -title "MISSING DISK IMAGE" "$MSG1" + fi + exit 9 + fi +else + echo "$IMGFILE specified in ~/.chroot" >/dev/stderr +fi + +# +#Make the temp dir bigger for OpenOffice etc. +# +#This comes from the config file... +#If not, fall back to a 6MB /tmp dir +# + +[ "x$TMPSIZE" != x ] || TMPSIZE=6M +mount -o remount,size=$TMPSIZE /tmp + +# All exported variables need to be defined in the chroot with this script. + +qchroot $IMGFILE $CHROOT su - "$@"