3 # Share a directory tree with an overlay-boot subhost
5 # $1 = directory $2 = subhost
9 . $(dirname $(realpath $0))/functions
11 if [ ! -d "$1" ] ; then
12 echo "** Not a directory: $1" >&2
19 [ -z "$NAME" ] && echo "Select subhost: $(list_running)" && exit 0
21 read USPID RSPID <<EOF
24 [ -z "$USPID" ] && echo "$NAME is not running" >&2 && exit 1
25 if [ -z "$RSPID" ] ; then
27 *** $NAME is started (pid $USPID) but doesn't seem to be running
28 *** /.reaper and might need manual fixing.
33 sudo nsenter -t "$RSPID" -n -m -p /bin/bash <<EOF
35 LIVE=\$(awk '\$1=="$NAME" && \$3=="overlay" {print \$2;}' < /proc/mounts)
36 [ -d "\$LIVE" ] && mount --bind $SHARE "\$LIVE$SHARE"
38 echo "Sharing $SHARE with subhost $NAME"