diskimage-builder/elements/dpkg/root.d/99-block-daemons
Russell Sim b9348447b9 Don't block the upstart daemon if it doesn't exist
Check if Upstart exists before blocking the daemon.  Not all dpkg based
OS's have Upstart installed so this should help increase compatibility.

Closes-Bug: #1251949
Change-Id: I2dcb1ff3641778b5653ca5762a728398adb57da1
2013-11-17 14:46:14 +11:00

34 lines
946 B
Bash
Executable File

#!/bin/bash
set -e
[ -n "$TARGET_ROOT" ]
# Prevent package installs from starting daemons
sudo mv $TARGET_ROOT/sbin/start-stop-daemon $TARGET_ROOT/sbin/start-stop-daemon.REAL
sudo dd of=$TARGET_ROOT/sbin/start-stop-daemon <<EOF
#!/bin/sh
echo
echo "Warning: Fake start-stop-daemon called, doing nothing"
EOF
sudo chmod 755 $TARGET_ROOT/sbin/start-stop-daemon
if [ -f $TARGET_ROOT/sbin/initctl ]
then
sudo mv $TARGET_ROOT/sbin/initctl $TARGET_ROOT/sbin/initctl.REAL
sudo dd of=$TARGET_ROOT/sbin/initctl <<EOF
#!/bin/sh
echo "initctl (tripleo 1.0)"
echo "Warning: Fake initctl called, doing nothing"
EOF
sudo chmod 755 $TARGET_ROOT/sbin/initctl
fi
sudo mv $TARGET_ROOT/usr/sbin/invoke-rc.d $TARGET_ROOT/usr/sbin/invoke-rc.d.REAL
sudo dd of=$TARGET_ROOT/usr/sbin/invoke-rc.d <<EOF
#!/bin/sh
echo "invoke-rc.d (tripleo 1.0)"
echo "Warning: Fake invoke-rc.d called, doing nothing"
EOF
sudo chmod 755 $TARGET_ROOT/usr/sbin/invoke-rc.d