File: overlay-go

package info (click to toggle)
overlay-boot 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: sh: 253; makefile: 59; ansic: 26
file content (30 lines) | stat: -rwxr-xr-x 732 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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

[ -z "$USPID" ] && echo "$NAME is not running" >&2 && exit 1

if [ -z "$RSPID" ] ; then
    cat <<EOF >&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"