2010-10-02 15:58:18 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# The script is called with the following arguments:
|
2013-07-26 08:51:06 +00:00
|
|
|
# $1 = $DIR - the top directory of the bootstrapped system
|
2010-10-02 15:58:18 +00:00
|
|
|
# $2 = $ARCH - the specified architecture, already checked with dpkg-architecture.
|
|
|
|
# setup.sh needs to be executable.
|
|
|
|
|
|
|
|
TARGET=$1
|
2011-01-29 15:45:07 +00:00
|
|
|
# upstart support
|
2010-10-02 15:58:18 +00:00
|
|
|
if [ -x "$TARGET/sbin/initctl" ]; then
|
2011-01-29 15:45:07 +00:00
|
|
|
echo "initctl: Trying to prevent daemons from starting in $TARGET"
|
|
|
|
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
|
|
|
echo \
|
2010-10-02 15:58:18 +00:00
|
|
|
"#!/bin/sh
|
|
|
|
echo
|
|
|
|
echo echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
2011-01-29 15:45:07 +00:00
|
|
|
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
2010-10-02 15:58:18 +00:00
|
|
|
fi
|
|
|
|
if [ -x "$TARGET/sbin/initctl" ]; then
|
2011-01-29 15:45:07 +00:00
|
|
|
echo "initctl: Trying to prevent daemons from starting in $TARGET"
|
|
|
|
mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL"
|
|
|
|
echo \
|
2010-10-02 15:58:18 +00:00
|
|
|
"#!/bin/sh
|
|
|
|
echo
|
|
|
|
echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl"
|
2011-01-29 15:45:07 +00:00
|
|
|
chmod 755 "$TARGET/sbin/initctl"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# sysvinit support - exit value of 101 is essential.
|
2011-02-01 22:10:17 +00:00
|
|
|
if [ -x "$TARGET/sbin/init" -a ! -f "$TARGET/usr/sbin/policy-rc.d" ]; then
|
2011-01-29 15:45:07 +00:00
|
|
|
echo "sysvinit: Using policy-rc.d to prevent daemons from starting in $TARGET"
|
|
|
|
mkdir -p $TARGET/usr/sbin/
|
|
|
|
cat > $TARGET/usr/sbin/policy-rc.d << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
echo "sysvinit: All runlevel operations denied by policy" >&2
|
|
|
|
exit 101
|
|
|
|
EOF
|
|
|
|
chmod a+x $TARGET/usr/sbin/policy-rc.d
|
2010-10-02 15:58:18 +00:00
|
|
|
fi
|