Add support for OpenRC

This commit is contained in:
MonkeysAreEvil 2020-01-02 18:33:41 +11:00 committed by happy_shredder
parent 3f34a935b9
commit 90a7742b65
No known key found for this signature in database
GPG Key ID: DFA13BAD5ADA43CE
3 changed files with 32 additions and 0 deletions

View File

@ -68,6 +68,15 @@ build_deb: base units
install: base units chcon daemon-reload
openrc:
install -d $(DESTDIR)$(SYSCONFDIR)/init.d
-sed "s|:TARGET_SBINDIR:|$(SBINDIR)|g;s|:TARGET_SYSCONFDIR:|$(SYSCONFDIR)|g" nohang/openrc/nohang.in > nohang/openrc/nohang
-sed "s|:TARGET_SBINDIR:|$(SBINDIR)|g;s|:TARGET_SYSCONFDIR:|$(SYSCONFDIR)|g" nohang/openrc/nohang-desktop.in > nohang/openrc/nohang-desktop
install -m0775 nohang/openrc/nohang $(DESTDIR)$(SYSCONFDIR)/init.d/nohang
install -m0775 nohang/openrc/nohang-desktop $(DESTDIR)$(SYSCONFDIR)/init.d/nohang-desktop
install-openrc: base openrc
uninstall:
# 'make uninstall' must not fail with error if systemctl is unavailable or returns error
-systemctl stop nohang.service || true
@ -90,3 +99,10 @@ uninstall:
rm -fvr $(DESTDIR)$(LOGDIR)/nohang/
rm -fvr $(DESTDIR)$(DOCDIR)/
rm -fvr $(DESTDIR)$(DATADIR)/nohang/
uninstall-openrc: uninstall
# 'make uninstall-openrc' must not fail with error if openrc is unavailable or returns error
-rc-service nohang-desktop stop || true
-rc-service nohang stop || true
rm -fv /etc/init.d/nohang-desktop
rm -fv /etc/init.d/nohang

View File

@ -0,0 +1,8 @@
#!/sbin/openrc-run
name="nohang-desktop daemon"
description="Sophisticated low memory handler"
command=:TARGET_SBINDIR:/nohang
command_args="--monitor --config :TARGET_SYSCONFDIR:/nohang/nohang-desktop.conf"
pidfile="/var/run/nohang-desktop"
start_stop_daemon_args="--background --make-pidfile"

8
nohang/openrc/nohang.in Executable file
View File

@ -0,0 +1,8 @@
#!/sbin/openrc-run
name="nohang daemon"
description="Sophisticated low memory handler"
command=:TARGET_SBINDIR:/nohang
command_args="--monitor --config :TARGET_SYSCONFDIR:/nohang/nohang.conf"
pidfile="/var/run/nohang"
start_stop_daemon_args="--background --make-pidfile"