# subhost is defined by a configuration file named on teh command line
[ $(id -u) = 0 ] || exec sudo $0 $@
-
-. $(dirname $(realpath $0))/functions
-
+. $(dirname $(realpath $0))/functions $*
CONFIG="$1"
[ -r "$CONFIG" ] || die "Missing configuration $CONFIG"
-
config NAME $(basename $1 .${1##*.})
config LOG /tmp/oly-$NAME.log
fi
config BASE
+BASE="$(cd $(dirname $CONFIG); realpath $BASE)"
+
config LIVE "$BASE/live"
config UPPER "$BASE/root"
config WORK "$BASE/work"
CMD="unshare -fp --mount-proc ip netns exec $NAME chroot $LIVE /bin/sh"
echo "$CMD"
+
cat <<EOF | $CMD
set -x
-mount --bind $UPPER/run /run
+mount -t proc proc /proc
for srv in $START ; do service \$srv start ; done
exec /.reaper $NAME
EOF
echo "EXITED $CMD"
-#echo "$STOP" | ip netns exec $NAME chroot $LIVE $SUBSHELL