2 # Chroots to Debian and runs a shell, or any command-line as non-root.
4 # By Alan M Bruce (qole), Benson Mitchell and Thomas Perl
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...
17 # If not, fall back on $USER, then 'user'
18 [ "x$DEBUSER" != x ] || DEBUSER=$USER
19 [ "x$DEBUSER" != x ] || DEBUSER=user
24 #If display's not given, go to primary display. If it's set, let's not
25 #mangle it to allow convenient use of USB VGA out, or multiple Xomaps.
26 [ "x$DISPLAY" != x ] || export DISPLAY=:0.0
28 #This enables long-hold-to-right-click in all GTK+ apps.
29 #Maybe we'd be better to add libgtkstylus.so anyway, but for now, we'll
30 #just leave it if they've got any non-empty GTK_MODULES
31 [ "x$GTK_MODULES" != x ] || export GTK_MODULES=libgtkstylus.so
33 #Note use of su below, so no Debian-side script req'd to drop privileges.
34 #With no args, use a shell; su will get the right one, with no -c
35 #With args, just run them as $DEBUSER.
38 echo Starting Debian shell... >/dev/stderr
39 sudo /sbin/debian su $DEBUSER
41 # Workaround to allow "debbie" to be used as login shell
42 if [ "$1" == "-c" ]; then
45 echo Starting Debian $* >/dev/stderr
46 sudo /sbin/debian su $DEBUSER -c "$*"