This is my first upload to my repository! Please bear with me...
[easy-deb-chroot] / src / sbin / debian~
diff --git a/src/sbin/debian~ b/src/sbin/debian~
new file mode 100644 (file)
index 0000000..3dac113
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Sets up (if necessary) for chroot into a Debian environment.
+# Expects root privileges, does not drop them. 
+# Look to /usr/bin/debbie for a friendly wrapper.
+
+# By Alan M Bruce (qole) with help from Benson Mitchell
+#
+# 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 /media/mmc?/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
+
+#Messy hack to make tap-and-hold work with GTK apps.
+export GTK_MODULES=libgtkstylus.so
+
+#Some OpenOffice environment variables
+export SAL_USE_VCLPLUGIN="gtk"
+export OOO_FORCE_DESKTOP="gnome"
+export SAL_NOOPENGL="true"
+export OOO_DISABLE_RECOVERY="true"
+export SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION="true"
+#export SAL_DISABLE_CUPS="true"
+
+qchroot $IMGFILE $CHROOT "$@"