Add bind-mount for /etc/adjtime to make subhost use host clock without ado
[rrq/overlay-boot.git] / overlay-go
1 #!/bin/sh
2
3 [ $(id -u) = 0 ] || exec sudo $0 $@
4 . $(dirname $(realpath $0))/functions XXX
5
6 NAME="$1"
7
8 [ -z "$NAME" ] && echo "Select subhost: $(list_running)" && exit 0
9
10 read USPID RSPID <<EOF
11 $(is_live $NAME)
12 EOF
13
14 [ -z "$USPID" ] && echo "$NAME is not running" >&2 && exit 1
15
16 if [ -z "$RSPID" ] ; then
17     cat <<EOF >&2
18 ***  $NAME is started (pid $USPID) but doesn't seem to be running
19 *** /.reaper and might need manual fixing.
20 EOF
21     exit 1
22 fi
23
24 sudo nsenter -t "$RSPID" -n -m -p -r -w -i -u -C /bin/bash
25 if [ $? = 137 ] ; then
26     echo "######### please 'fg' this again (if stopped)" >&2
27     stty sane # a killed bash might leave the tty insane and stty
28               # typically gets stopped trying to correct it
29 fi
30 echo "done"