install_easy: always check init process name in detection

This commit is contained in:
bol-van 2021-11-20 18:29:22 +03:00
parent 528328a2b5
commit 45c3aa2796
2 changed files with 8 additions and 6 deletions

View File

@ -206,12 +206,13 @@ check_system()
local UNAME=$(uname) local UNAME=$(uname)
if [ "$UNAME" = "Linux" ]; then if [ "$UNAME" = "Linux" ]; then
local INIT="$(basename $(readlink /proc/1/exe))"
# some distros include systemctl without systemd # some distros include systemctl without systemd
if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$(basename $(readlink /proc/1/exe))" = "systemd" ]; then if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$INIT" = "systemd" ]; then
SYSTEM=systemd SYSTEM=systemd
elif exists rc-update && [ "$(basename $(readlink /proc/1/exe))" = "openrc-init" ]; then elif exists rc-update && [ "$INIT" = "openrc-init" ]; then
SYSTEM=openrc SYSTEM=openrc
elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci && [ "$INIT" = "procd" ] ; then
SYSTEM=openwrt SYSTEM=openwrt
else else
echo system is not either systemd, openrc or openwrt based echo system is not either systemd, openrc or openwrt based

View File

@ -53,12 +53,13 @@ check_system()
local UNAME=$(uname) local UNAME=$(uname)
if [ "$UNAME" = "Linux" ]; then if [ "$UNAME" = "Linux" ]; then
local INIT="$(basename $(readlink /proc/1/exe))"
# some distros include systemctl without systemd # some distros include systemctl without systemd
if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$(basename $(readlink /proc/1/exe))" = "systemd" ]; then if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$INIT" = "systemd" ]; then
SYSTEM=systemd SYSTEM=systemd
elif exists rc-update && [ "$(basename $(readlink /proc/1/exe))" = "openrc-init" ]; then elif exists rc-update && [ "$INIT" = "openrc-init" ]; then
SYSTEM=openrc SYSTEM=openrc
elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci && [ "$INIT" = "procd" ] ; then
SYSTEM=openwrt SYSTEM=openwrt
else else
echo system is not either systemd, openrc or openwrt based echo system is not either systemd, openrc or openwrt based