2013-11-15 13:21:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2013-11-15 13:21:56 +00:00
|
|
|
set -eu
|
2014-04-03 02:24:15 +00:00
|
|
|
set -o pipefail
|
2013-11-15 13:21:56 +00:00
|
|
|
|
2017-01-02 21:18:47 +00:00
|
|
|
# Debian Jessie and Debian Stretch use /bin/systemctl.
|
|
|
|
# (/sbin/init is only available if systemd-sysv is installed.)
|
|
|
|
|
|
|
|
if [ -f /usr/bin/systemctl -o -f /bin/systemctl ]; then
|
2016-02-18 13:20:48 +00:00
|
|
|
echo "systemd"
|
|
|
|
elif [[ -f /sbin/initctl ]]; then
|
2013-11-15 13:21:56 +00:00
|
|
|
echo "upstart"
|
2016-01-28 21:53:13 +00:00
|
|
|
elif [[ -f /etc/gentoo-release ]]; then
|
2018-04-12 18:24:59 +00:00
|
|
|
if [[ -z GENTOO_PROFILE ]]; then
|
|
|
|
if [[ "${GENTOO_PROFILE}" =~ systemd ]]; then
|
|
|
|
echo "systemd"
|
|
|
|
fi
|
2016-01-28 21:53:13 +00:00
|
|
|
else
|
|
|
|
echo "openrc"
|
|
|
|
fi
|
|
|
|
elif [[ -f /sbin/init ]]; then
|
|
|
|
if [[ -f /bin/systemd ]]; then
|
2013-11-15 13:21:56 +00:00
|
|
|
echo "systemd"
|
|
|
|
else
|
|
|
|
echo "sysv"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Unknown init system"
|
|
|
|
exit 1
|
|
|
|
fi
|