Browse Source

Added remove hook script

nohooks-patch 0.3.4
M. Herdiansyah 4 years ago
parent
commit
06f24805f4
  1. 1
      Makefile
  2. 10
      initswitch-remove-hook-script

1
Makefile

@ -14,6 +14,7 @@ install:
install -m755 initswitch $(DESTDIR)$(PREFIX)/bin/initswitch
install -m644 initswitch-hook $(DESTDIR)$(PREFIX)/share/libalpm/hooks/initswitch.hook
install -m755 initswitch-hook-script $(DESTDIR)$(PREFIX)/share/libalpm/scripts/initswitch
install -m755 initswitch-remove-hook-script $(DESTDIR)$(PREFIX)/share/libalpm/scripts/initswitch-remove
install -d $(DESTDIR)$(PREFIX)/share/man/man8
install -m644 halt.8 $(DESTDIR)$(PREFIX)/share/man/man8/halt.8
ln -sf halt.8 $(DESTDIR)$(PREFIX)/share/man/man8/shutdown.8

10
initswitch-remove-hook-script

@ -0,0 +1,10 @@
#!/bin/sh
case $1 in
"openrc") [ "$(cat /proc/1/comm)" == "init" ] && initrunning=1 ;;
"runit") [ "$(cat /proc/1/comm)" == "runit" ] && initrunning=1 ;;
esac
if [ $initrunning = 1 ]; then
echo " $1 is currently running as your init system. You cannot remove it."
exit 1
fi