2dd6dd357a
Can't use a variable that's not set. Change-Id: I4a7cf2ac47c2254da2fec778437f67c1fe3707f7
34 lines
722 B
Bash
Executable File
34 lines
722 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
# 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
|
|
echo "systemd"
|
|
elif [[ -f /sbin/initctl ]]; then
|
|
echo "upstart"
|
|
elif [[ -f /etc/gentoo-release ]]; then
|
|
if [[ -z GENTOO_PROFILE ]]; then
|
|
if [[ "${GENTOO_PROFILE}" =~ systemd ]]; then
|
|
echo "systemd"
|
|
fi
|
|
else
|
|
echo "openrc"
|
|
fi
|
|
elif [[ -f /sbin/init ]]; then
|
|
if [[ -f /bin/systemd ]]; then
|
|
echo "systemd"
|
|
else
|
|
echo "sysv"
|
|
fi
|
|
else
|
|
echo "Unknown init system"
|
|
exit 1
|
|
fi
|