Add dinit init system (#690)

* Add dinit support
This commit is contained in:
Angel 2024-05-09 18:26:50 +02:00 committed by GitHub
parent 78c3f71438
commit 281a7adc34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,3 @@
type = scripted
command = /usr/local/bin/auto-cpufreq --daemon
run-as = root

View File

@ -89,6 +89,16 @@ elif [ "$(ps h -o comm 1)" = "s6-svscan" ];then
s6-rc -u change auto-cpufreq default
echo -e "\n* Update daemon service bundle (s6)"
s6-db-reload
# Install script for dinit
elif [ "$(ps h -o comm 1)" = "dinit" ];then
echo -e "\n* Deploying auto-cpufreq dinit unit file"
cp /usr/local/share/auto-cpufreq/scripts/auto-cpufreq-dinit /etc/dinit.d/auto-cpufreq
echo -e "Starting auto-cpufreq daemon (dinit) service"
dinitctl start auto-cpufreq
echo -e "\n* Enabling auto-cpufreq daemon (dinit) service at boot"
dinitctl 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"

View File

@ -52,6 +52,7 @@ elif [ "$(ps h -o comm 1)" = "systemd" ];then
echo -e "reset failed"
systemctl reset-failed
# Remove service for openrc
elif [ "$(ps h -o comm 1)" = "init" ];then
echo -e "\n* Stopping auto-cpufreq daemon (openrc) service"
rc-service auto-cpufreq stop
@ -69,6 +70,16 @@ elif [ "$(ps h -o comm 1)" = "s6-svscan" ];then
rm -rf /etc/s6/sv/auto-cpufreq
echo -e "\n* Update daemon service bundle (s6)"
s6-db-reload
# Remove service for dinit
elif [ "$(ps h -o comm 1)" = "init" ];then
echo -e "\n* Stopping auto-cpufreq daemon (dinit) service"
dinitctl stop auto-cpufreq
echo -e "\n* Disabling auto-cpufreq daemon (dinit) at boot"
dinitctl disable auto-cpufreq
echo -e "\n* Removing auto-cpufreq daemon (dinit) unit file"
rm /etc/dinit.d/auto-cpufreq
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"