diskimage-builder/elements/dib-init-system/post-install.d/10-enable-init-scripts
Matthew Thode 265b31e6b5
Add support for OpenRC to dib-init-system
Adds a post-install function that enables installed initscripts,
as that is not done by default in gentoo.

Change-Id: I04e8d506ddcbefa8a983dd31ad16df5e13cb26e7
Closes-Bug: 1539276
2016-02-02 17:23:35 -06:00

28 lines
674 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
SCRIPTS_DIR="$(dirname $0)/../init-scripts/${DIB_INIT_SYSTEM}/"
if [[ -d "${SCRIPTS_DIR}" ]]; then
# figure out init prefix
case "${DIB_INIT_SYSTEM}" in
upstart) ;;
openrc)
# only gentoo needs manual runlevel adding
for INIT_SCRIPT in "${SCRIPTS_DIR}"*; do
rc-update add $(basename "${INIT_SCRIPT}") default
done
;;
systemd) ;;
sysv) ;;
*)
echo "ERROR: DIB_INIT_SYSTEM (${DIB_INIT_SYSTEM}) is not a known type"
exit 1
;;
esac
fi