From 45c3aa2796f30f85896eb00c0156b397039a31c7 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sat, 20 Nov 2021 18:29:22 +0300 Subject: [PATCH] install_easy: always check init process name in detection --- install_easy.sh | 7 ++++--- uninstall_easy.sh | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/install_easy.sh b/install_easy.sh index 55d547d..2d6a91f 100755 --- a/install_easy.sh +++ b/install_easy.sh @@ -206,12 +206,13 @@ check_system() local UNAME=$(uname) if [ "$UNAME" = "Linux" ]; then + local INIT="$(basename $(readlink /proc/1/exe))" # 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 - elif exists rc-update && [ "$(basename $(readlink /proc/1/exe))" = "openrc-init" ]; then + elif exists rc-update && [ "$INIT" = "openrc-init" ]; then 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 else echo system is not either systemd, openrc or openwrt based diff --git a/uninstall_easy.sh b/uninstall_easy.sh index 738befd..84eb903 100755 --- a/uninstall_easy.sh +++ b/uninstall_easy.sh @@ -53,12 +53,13 @@ check_system() local UNAME=$(uname) if [ "$UNAME" = "Linux" ]; then + local INIT="$(basename $(readlink /proc/1/exe))" # 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 - elif exists rc-update && [ "$(basename $(readlink /proc/1/exe))" = "openrc-init" ]; then + elif exists rc-update && [ "$INIT" = "openrc-init" ]; then 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 else echo system is not either systemd, openrc or openwrt based