#!/bin/sh
# Chroots to Debian and runs a shell, or any command-line as non-root.
-# By Alan M Bruce (qole) and Benson Mitchell
+# By Alan M Bruce (qole), Benson Mitchell and Thomas Perl
#
# GPL licensed; keep code free!
[ -f /home/user/.chroot ] && . /home/user/.chroot
#This comes from the config file... If not, fall back on 'user'
-[ "x$DEBUSER" != x ] || DEBUSER=user
+#[ "x$DEBUSER" != x ] || DEBUSER=user
+DEBUSER=$USER
CHROOTUSER=$DEBUSER
#With args, just run them as $DEBUSER.
if [ $# = 0 ] ; then
- echo Starting Debian shell...
+ echo Starting Debian shell... >/dev/stderr
sudo /sbin/debian su $DEBUSER
else
- echo Starting Debian $1
+ # Workaround to allow "debbie" to be used as login shell
+ if [ "$1" == "-c" ]; then
+ shift
+ fi
+ echo Starting Debian $* >/dev/stderr
sudo /sbin/debian su $DEBUSER -c "$*"
fi