Skip to content

Commit

Permalink
Add dinit init system (#690)
Browse files Browse the repository at this point in the history
* Add dinit support
  • Loading branch information
Angel-Karasu authored May 9, 2024
1 parent 78c3f71 commit 281a7ad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/auto-cpufreq-dinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type = scripted
command = /usr/local/bin/auto-cpufreq --daemon
run-as = root
10 changes: 10 additions & 0 deletions scripts/auto-cpufreq-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 11 additions & 0 deletions scripts/auto-cpufreq-remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 281a7ad

Please sign in to comment.