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
This commit is contained in:
parent
4526cf23ec
commit
265b31e6b5
@ -6,12 +6,18 @@ fi
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
if [ -f /sbin/initctl ]; then
|
if [[ -f /sbin/initctl ]]; then
|
||||||
echo "upstart"
|
echo "upstart"
|
||||||
elif [ -f /usr/bin/systemctl ]; then
|
elif [[ -f /etc/gentoo-release ]]; then
|
||||||
|
if [[ "${GENTOO_PROFILE}" =~ systemd ]]; then
|
||||||
echo "systemd"
|
echo "systemd"
|
||||||
elif [ -f /sbin/init ]; then
|
else
|
||||||
if [ -f /bin/systemd ]; then
|
echo "openrc"
|
||||||
|
fi
|
||||||
|
elif [[ -f /usr/bin/systemctl ]]; then
|
||||||
|
echo "systemd"
|
||||||
|
elif [[ -f /sbin/init ]]; then
|
||||||
|
if [[ -f /bin/systemd ]]; then
|
||||||
echo "systemd"
|
echo "systemd"
|
||||||
else
|
else
|
||||||
echo "sysv"
|
echo "sysv"
|
||||||
|
@ -14,12 +14,13 @@ if [ -d "$scripts_dir" ]; then
|
|||||||
dest=
|
dest=
|
||||||
case $DIB_INIT_SYSTEM in
|
case $DIB_INIT_SYSTEM in
|
||||||
upstart) dest=/etc/init/ ;;
|
upstart) dest=/etc/init/ ;;
|
||||||
|
openrc) dest=/etc/init.d/ ;;
|
||||||
systemd) dest=/usr/lib/systemd/system/ ;;
|
systemd) dest=/usr/lib/systemd/system/ ;;
|
||||||
sysv) dest=/etc/init.d/ ;;
|
sysv) dest=/etc/init.d/ ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -z "$dest" ]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
cp -RP $scripts_dir. $dest || true
|
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 New Issue
Block a user