From 528328a2b586de2b660aff33473b9369644e5699 Mon Sep 17 00:00:00 2001
From: bol-van <k@vodka.home.kg>
Date: Sat, 20 Nov 2021 18:08:31 +0300
Subject: [PATCH] install_easy: improve openrc detection

---
 install_easy.sh   | 4 ++--
 uninstall_easy.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/install_easy.sh b/install_easy.sh
index 994f0c9..55d547d 100755
--- a/install_easy.sh
+++ b/install_easy.sh
@@ -209,10 +209,10 @@ check_system()
 		# some distros include systemctl without systemd
 		if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$(basename $(readlink /proc/1/exe))" = "systemd" ]; then
 			SYSTEM=systemd
+		elif exists rc-update && [ "$(basename $(readlink /proc/1/exe))" = "openrc-init" ]; then
+			SYSTEM=openrc
 		elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then
 			SYSTEM=openwrt
-		elif exists /sbin/openrc-run || exists /usr/sbin/openrc-run ; then
-			SYSTEM=openrc
 		else
 			echo system is not either systemd, openrc or openwrt based
 			echo easy installer can set up config settings but can\'t configure auto start
diff --git a/uninstall_easy.sh b/uninstall_easy.sh
index b9f1668..738befd 100755
--- a/uninstall_easy.sh
+++ b/uninstall_easy.sh
@@ -56,10 +56,10 @@ check_system()
 		# some distros include systemctl without systemd
 		if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$(basename $(readlink /proc/1/exe))" = "systemd" ]; then
 			SYSTEM=systemd
+		elif exists rc-update && [ "$(basename $(readlink /proc/1/exe))" = "openrc-init" ]; then
+			SYSTEM=openrc
 		elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then
 			SYSTEM=openwrt
-		elif exists /sbin/openrc-run || exists /usr/sbin/openrc-run ; then
-			SYSTEM=openrc
 		else
 			echo system is not either systemd, openrc or openwrt based
 			echo check readme.txt for manual setup info.