Zap spurious sudo usage
[rrq/overlay-boot.git] / overlay-go
index d22ef35a0310718ca2ad11889b7b781c66d40acd..8724fbd5fa133346a9ceb4c06bd2c1800df567d1 100755 (executable)
@@ -1,10 +1,11 @@
 #!/bin/sh
 
-[ $(id -u) = 0 ] || exec sudo $0 $@
 . $(dirname $(realpath $0))/functions XXX
 
 NAME="$1"
 
+[ -z "$NAME" ] && echo "Select subhost: $(list_running)" && exit 0
+
 read USPID RSPID <<EOF
 $(is_live $NAME)
 EOF
@@ -19,4 +20,10 @@ EOF
     exit 1
 fi
 
-sudo nsenter -t "$RSPID" -n -m -p -r -w -u -C /bin/bash
+nsenter -t "$RSPID" -n -m -p -r -w -i -u -C /bin/bash
+if [ $? = 137 ] ; then
+    echo "######### please 'fg' this again (if stopped)" >&2
+    stty sane # a killed bash might leave the tty insane and stty
+              # typically gets stopped trying to correct it
+fi
+echo "done"