Merge "Add support for OpenRC to dib-init-system"
This commit is contained in:
commit
5ee1cbac4a
3 changed files with 39 additions and 5 deletions
|
@ -6,12 +6,18 @@ fi
|
|||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -f /sbin/initctl ]; then
|
||||
if [[ -f /sbin/initctl ]]; then
|
||||
echo "upstart"
|
||||
elif [ -f /usr/bin/systemctl ]; then
|
||||
elif [[ -f /etc/gentoo-release ]]; then
|
||||
if [[ "${GENTOO_PROFILE}" =~ systemd ]]; then
|
||||
echo "systemd"
|
||||
else
|
||||
echo "openrc"
|
||||
fi
|
||||
elif [[ -f /usr/bin/systemctl ]]; then
|
||||
echo "systemd"
|
||||
elif [ -f /sbin/init ]; then
|
||||
if [ -f /bin/systemd ]; then
|
||||
elif [[ -f /sbin/init ]]; then
|
||||
if [[ -f /bin/systemd ]]; then
|
||||
echo "systemd"
|
||||
else
|
||||
echo "sysv"
|
||||
|
|
|
@ -14,12 +14,13 @@ 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 an unknown type"
|
||||
echo "ERROR: DIB_INIT_SYSTEM ($DIB_INIT_SYSTEM) is not a known type"
|
||||
exit 1
|
||||
fi
|
||||
cp -RP $scripts_dir. $dest || true
|
||||
|
|
27
elements/dib-init-system/post-install.d/10-enable-init-scripts
Executable file
27
elements/dib-init-system/post-install.d/10-enable-init-scripts
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/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
|
Loading…
Reference in a new issue