From 342e5fab86136024a6d200f16b7c7212cf72ef35 Mon Sep 17 00:00:00 2001 From: bobslept <38557801+bobslept@users.noreply.github.com> Date: Wed, 8 Dec 2021 07:50:40 +0100 Subject: [PATCH] Verify the use of supported init systems. (#303) --- scripts/auto-cpufreq-install.sh | 5 ++++- scripts/auto-cpufreq-remove.sh | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/auto-cpufreq-install.sh b/scripts/auto-cpufreq-install.sh index 6df8621..585c80c 100755 --- a/scripts/auto-cpufreq-install.sh +++ b/scripts/auto-cpufreq-install.sh @@ -55,7 +55,7 @@ if [ "$(ps h -o comm 1)" = "runit" ];then esac fi # Install script for systemd -else +elif [ "$(ps h -o comm 1)" = "systemd" ];then echo -e "\n* Deploy auto-cpufreq systemd unit file" cp /usr/local/share/auto-cpufreq/scripts/auto-cpufreq.service /etc/systemd/system/auto-cpufreq.service @@ -70,4 +70,7 @@ else echo -e "\n* Enabling auto-cpufreq daemon (systemd) service at boot" systemctl enable auto-cpufreq +else + echo -e "\n* Unsupported init system detected, could not install the daemon\n" + echo -e "\n* Please open an issue on https://github.com/AdnanHodzic/auto-cpufreq\n" fi diff --git a/scripts/auto-cpufreq-remove.sh b/scripts/auto-cpufreq-remove.sh index 73dfc1c..5990bfe 100755 --- a/scripts/auto-cpufreq-remove.sh +++ b/scripts/auto-cpufreq-remove.sh @@ -36,7 +36,8 @@ if [ "$(ps h -o comm 1)" = "runit" ];then esac fi -else +# Remove service for systemd +elif [ "$(ps h -o comm 1)" = "systemd" ];then echo -e "\n* Stopping auto-cpufreq daemon (systemd) service" systemctl stop auto-cpufreq @@ -51,4 +52,7 @@ else echo -e "reset failed" systemctl reset-failed +else + echo -e "\n* Unsupported init system detected, could not remove the daemon\n" + echo -e "\n* Please open an issue on https://github.com/AdnanHodzic/auto-cpufreq\n" fi