-# -----------------------------------------------------------------------------
-# check for systemd
-
-issystemd() {
- local pids p myns ns systemctl
-
- # if the directory /etc/systemd/system does not exit, it is not systemd
- [ ! -d /etc/systemd/system ] && return 1
-
- # if there is no systemctl command, it is not systemd
- systemctl=$(which systemctl 2>/dev/null || command -v systemctl 2>/dev/null)
- [ -z "${systemctl}" -o ! -x "${systemctl}" ] && return 1
-
- # if pid 1 is systemd, it is systemd
- [ "$(basename $(readlink /proc/1/exe) 2>/dev/null)" = "systemd" ] && return 0
-
- # if systemd is not running, it is not systemd
- pids=$(pidof systemd 2>/dev/null)
- [ -z "${pids}" ] && return 1
-
- # check if the running systemd processes are not in our namespace
- myns="$(readlink /proc/self/ns/pid 2>/dev/null)"
- for p in ${pids}
- do
- ns="$(readlink /proc/${p}/ns/pid 2>/dev/null)"
-
- # if pid of systemd is in our namespace, it is systemd
- [ ! -z "${myns}" && "${myns}" = "${ns}" ] && return 0
- done
-
- # else, it is not systemd
- return 1
-}
-
-started=0
-if [ "${UID}" -eq 0 ]
- then
-
- if issystemd