3 # This boot scripts runs a service subhost as defined by the
4 # configuration file named on the command line.
5 # See "man overlay-boot" for details.
8 PROGRAMDIR="$(dirname $(realpath $0))"
9 . $PROGRAMDIR/functions
13 if [ -z "$UNSHARED" ] ; then
14 if [ ! -r /run/netns/$NAME ] ; then
16 ip netns exec $NAME ip link set lo up || exit 1
18 exec env UNSHARED=yes unshare -m $0 $@ > $LOG 2>&1 &
19 echo "Logging to $LOG" >&2
24 setup_veth_cables $NAME $CABLES
25 setup_overlay "$NAME" "$LIVE" "$LOWER" "$UPPER" "$WORK"
29 [ "$UPPER" != "$LIVE" ] && umount -R "$LIVE"
33 CMD="unshare -fp --mount-proc -i -u ip netns exec $NAME chroot $LIVE /bin/sh"
35 env CONFIG="$CONFIG" $INIT | $CMD