X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=overlay-go;h=991067d5a453c20bf629d4392097499a10087331;hb=6b65dda096b1e7981b5c827ab4fcbec53b026664;hp=dd557d85e1f2dc3c784d1deed92b7a554d436c29;hpb=df3ccb2170beff852f8ec7d421709c5e85bafc7d;p=rrq%2Foverlay-boot.git diff --git a/overlay-go b/overlay-go index dd557d8..991067d 100755 --- a/overlay-go +++ b/overlay-go @@ -1,8 +1,30 @@ #!/bin/sh -set -x -X="$(pgrep -f ".reaper $1")" -grep -q "^proc " /proc/$X/mounts || \ - sudo nsenter -t "$X" -m -p -r -w mount -t proc proc /proc -ROOT="$(sudo nsenter -t "$X" -m -p -r -w mount | \ - awk -v S="$1" '$1==S{print $3;exit;}')" -sudo nsenter -t "$X" -n -m -p -r -w -u -C /bin/bash + +[ $(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 <&2 && exit 1 + +if [ -z "$RSPID" ] ; then + cat <&2 +*** $NAME is started (pid $USPID) but doesn't seem to be running +*** /.reaper and might need manual fixing. +EOF + exit 1 +fi + +sudo 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"