b01c73aadc
dib-init-system script is installed into $PATH. Called without arguments it will print the name of init system used to stdout. Additionally, set DIB_INIT_SYSTEM environment variable to the init system used. Tested on ubuntu+upstart, centos+upstart, fedora+systemd, debian+sysv. Closes-Bug: #1251610 Change-Id: I29668079091f6060dab66d8259890384d3bbd653
19 lines
298 B
Bash
Executable File
19 lines
298 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
if [ -f /sbin/initctl ]; then
|
|
echo "upstart"
|
|
elif [ -f /usr/bin/systemctl ]; then
|
|
echo "systemd"
|
|
elif [ -f /sbin/init ]; then
|
|
if [ -f /bin/systemd ]; then
|
|
echo "systemd"
|
|
else
|
|
echo "sysv"
|
|
fi
|
|
else
|
|
echo "Unknown init system"
|
|
exit 1
|
|
fi
|