Added Thomas Perl's patches to Fremantle scripts
[easy-deb-chroot] / fremantle / easy-deb-chroot / src / usr / bin / debbie
index 8d13632..9726148 100755 (executable)
@@ -1,7 +1,7 @@
 #!/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!
 
@@ -14,7 +14,8 @@ fi
 [ -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
 
@@ -32,9 +33,13 @@ 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