2 # Chroots to Debian and runs a shell, or any command-line as non-root.
4 # By Alan M Bruce (qole) and Benson Mitchell
6 # GPL licensed; keep code free!
8 if [ "`whoami`" = "root" ] ; then
9 echo "please don't run me as root!"
13 #Pull in the config, if possible...
14 [ -f /home/user/.chroot ] && . /home/user/.chroot
16 #This comes from the config file... If not, fall back on 'user'
17 [ "x$DEBUSER" != x ] || DEBUSER=user
21 #If display's not given, go to primary display. If it's set, let's not
22 #mangle it to allow convenient use of USB VGA out, or multiple Xomaps.
23 [ "x$DISPLAY" != x ] || export DISPLAY=:0.0
25 #This enables long-hold-to-right-click in all GTK+ apps.
26 #Maybe we'd be better to add libgtkstylus.so anyway, but for now, we'll
27 #just leave it if they've got any non-empty GTK_MODULES
28 [ "x$GTK_MODULES" != x ] || export GTK_MODULES=libgtkstylus.so
30 #Note use of su below, so no Debian-side script req'd to drop privileges.
31 #With no args, use a shell; su will get the right one, with no -c
32 #With args, just run them as $DEBUSER.
35 echo Starting Debian shell...
36 sudo /sbin/debian su $DEBUSER
38 echo Starting Debian $1
39 sudo /sbin/debian su $DEBUSER -c "$*"