#!/bin/sh
#
# This script performs default actions. It is invoked with CONFIG set
# for the subhost.

OVERLAYDIR="$(dirname $(realpath $0))"
. $OVERLAYDIR/functions

subhost_name "$CONFIG"
subhost_config

# Print the default init script
cat <<EOF
set -x
mount -t proc proc /proc
for srv in $START ; do service \$srv start ; done
dummy_service() {
    [ \$# -gt 3 ] && return 0
    echo "Starting dummy service" >&2
    set +x
    [ -p /run/dummy_service ] || mkfifo /run/dummy_service
    ( printf dummy_service > /proc/self/comm ; read X < /run/dummy_service ) &
    set -x
}
dummy_service /proc/*/comm
exec /.reaper $NAME
EOF
