Skip to content

Commit

Permalink
install_easy: always check init process name in detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bol-van committed Nov 20, 2021
1 parent 528328a commit 45c3aa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions install_easy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions uninstall_easy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 45c3aa2

Please sign in to comment.