diskimage-builder/elements/dib-init-system/install.d/20-install-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
781 B
Bash
Executable File

#!/bin/bash
# Note that this relies on the detail that all elements share one dir inside
# the chroot. This will copy all the files that elements have added to
# element/static into the image. Mode, symlinks etc will be respected.
if [ ${DIB_DEBUG_TRACE:-1} -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
dest=
case $DIB_INIT_SYSTEM in
upstart) dest=/etc/init/ ;;
openrc) dest=/etc/init.d/ ;;
systemd) dest=/usr/lib/systemd/system/ ;;
sysv) dest=/etc/init.d/ ;;
esac
if [ -z "$dest" ]; then
echo "ERROR: DIB_INIT_SYSTEM ($DIB_INIT_SYSTEM) is not a known type"
exit 1
fi
cp -RP $scripts_dir. $dest || true
fi