#!/bin/sh -efuC
set -o pipefail

# We might be unable to read it as another user and run /bin/sh "$SCRIPT".
# /bin/sh - would also be a valid command.
# Therefore, we first cat "$SCRIPT". ("cat -" also works.)
readonly SCRIPT="$1"; shift

# --pidfile doesn't exist and makes it always start.
cat "$SCRIPT" |
/sbin/start-stop-daemon --start --pidfile /var/empty/no.pid \
--chuid nobody:nobody \
--startas /bin/sh -- -ec \
'export TMPDIR=/tmp; \
. tmpdir.sh; \
cd  "$TMPDIR"; \
/bin/sh -e -'
