Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1618188fd2 | |||
| a54971dada | |||
| 6e5f39e281 | |||
| c4d712bcc4 | |||
| 199eee77c1 | |||
| faca7dbca1 |
23
Makefile
23
Makefile
@@ -21,8 +21,13 @@ S6CRONIEHOOKS = $(wildcard s6/cronie-hooks/*)
|
|||||||
S6DBUSHOOKS = $(wildcard s6/dbus-hooks/*)
|
S6DBUSHOOKS = $(wildcard s6/dbus-hooks/*)
|
||||||
S6ATDHOOKS = $(wildcard s6/atd-hooks/*)
|
S6ATDHOOKS = $(wildcard s6/atd-hooks/*)
|
||||||
|
|
||||||
DINITSCRIPTS = $(wildcard dinit/scripts/*)
|
DINITSYSTEMSCRIPTS = $(wildcard dinit/scripts/system/*)
|
||||||
DINITHOOKS = $(wildcard dinit/hooks/*)
|
DINITUSERSCRIPTS = $(wildcard dinit/scripts/user/*)
|
||||||
|
DINITSYSTEMHOOKS = $(wildcard dinit/hooks/system/*)
|
||||||
|
DINITUSERHOOKS = $(wildcard dinit/hooks/user/*)
|
||||||
|
|
||||||
|
DINITUSERSPAWNSCRIPTS = $(wildcard dinit/scripts/user-spawn/*)
|
||||||
|
DINITUSERSPAWNHOOKS = $(wildcard dinit/hooks/user-spawn/*)
|
||||||
|
|
||||||
DINITCRONIEHOOKS = $(wildcard dinit/cronie-hooks/*)
|
DINITCRONIEHOOKS = $(wildcard dinit/cronie-hooks/*)
|
||||||
DINITDBUSHOOKS = $(wildcard dinit/dbus-hooks/*)
|
DINITDBUSHOOKS = $(wildcard dinit/dbus-hooks/*)
|
||||||
@@ -78,8 +83,16 @@ install_s6: install_common
|
|||||||
install $(MODE) $(S6HOOKS) $(DESTDIR)$(HOOKSDIR)
|
install $(MODE) $(S6HOOKS) $(DESTDIR)$(HOOKSDIR)
|
||||||
|
|
||||||
install_dinit: install_common
|
install_dinit: install_common
|
||||||
install $(EMODE) $(DINITSCRIPTS) $(DESTDIR)$(SCRIPTSDIR)
|
install $(EMODE) $(DINITSYSTEMSCRIPTS) $(DESTDIR)$(SCRIPTSDIR)
|
||||||
install $(MODE) $(DINITHOOKS) $(DESTDIR)$(HOOKSDIR)
|
install $(MODE) $(DINITSYSTEMHOOKS) $(DESTDIR)$(HOOKSDIR)
|
||||||
|
|
||||||
|
install_dinit_user: install_common
|
||||||
|
install $(EMODE) $(DINITUSERSCRIPTS) $(DESTDIR)$(SCRIPTSDIR)
|
||||||
|
install $(MODE) $(DINITUSERHOOKS) $(DESTDIR)$(HOOKSDIR)
|
||||||
|
|
||||||
|
install_dinit_user_spawn: install_common
|
||||||
|
install $(EMODE) $(DINITUSERSPAWNSCRIPTS) $(DESTDIR)$(SCRIPTSDIR)
|
||||||
|
install $(MODE) $(DINITUSERSPAWNHOOKS) $(DESTDIR)$(HOOKSDIR)
|
||||||
|
|
||||||
install_openrc_cronie: install_hook_common
|
install_openrc_cronie: install_hook_common
|
||||||
install $(MODE) $(OPENRCCRONIEHOOKS) $(DESTDIR)$(HOOKSDIR)
|
install $(MODE) $(OPENRCCRONIEHOOKS) $(DESTDIR)$(HOOKSDIR)
|
||||||
@@ -112,4 +125,4 @@ install_wrapper:
|
|||||||
install $(DMODE) $(DESTDIR)$(BINDIR)
|
install $(DMODE) $(DESTDIR)$(BINDIR)
|
||||||
install $(EMODE) $(WRAPPER) $(DESTDIR)$(BINDIR)
|
install $(EMODE) $(WRAPPER) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
.PHONY: install install_base install_s6 install_openrc install_runit install_dinit install_wrapper
|
.PHONY: install install_base install_s6 install_openrc install_runit install_dinit install_wrapper install_dinit_user install_dinit_user_spawn
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
[Trigger]
|
|
||||||
Type = Path
|
|
||||||
Operation = Install
|
|
||||||
# Operation = Upgrade
|
|
||||||
Target = usr/lib/dinit.d/dinit-user-spawn
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Description = Enabling dinit user spawn ...
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/share/libalpm/scripts/dinit-hook userspawnE
|
|
||||||
NeedsTargets
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[Trigger]
|
|
||||||
Type = Path
|
|
||||||
Operation = Remove
|
|
||||||
Target = usr/lib/dinit.d/dinit-user-spawn
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Description = Disabling dinit user service help ...
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/share/libalpm/scripts/dinit-hook userspawnD
|
|
||||||
NeedsTargets
|
|
||||||
9
dinit/hooks/user-spawn/dinit-user-spawn-install.hook
Normal file
9
dinit/hooks/user-spawn/dinit-user-spawn-install.hook
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[Trigger]
|
||||||
|
Type = Package
|
||||||
|
Operation = Install
|
||||||
|
Target = dinit-user-spawn
|
||||||
|
[Action]
|
||||||
|
Description = Enabling dinit user spawn service ...
|
||||||
|
When = PostTransaction
|
||||||
|
Exec = /usr/share/libalpm/scripts/dinit-user-spawn-hook enable
|
||||||
|
# NeedsTargets
|
||||||
9
dinit/hooks/user-spawn/dinit-user-spawn-remove.hook
Normal file
9
dinit/hooks/user-spawn/dinit-user-spawn-remove.hook
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[Trigger]
|
||||||
|
Type = Package
|
||||||
|
Operation = Remove
|
||||||
|
Target = dinit-user-spawn
|
||||||
|
[Action]
|
||||||
|
Description = Disabling dinit user spawn service ...
|
||||||
|
When = PostTransaction
|
||||||
|
Exec = /usr/share/libalpm/scripts/dinit-user-spawn-hook disable
|
||||||
|
# NeedsTargets
|
||||||
@@ -7,5 +7,5 @@ Target = etc/dinit.d/user/*
|
|||||||
[Action]
|
[Action]
|
||||||
Description = Displaying dinit user service help ...
|
Description = Displaying dinit user service help ...
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/share/libalpm/scripts/dinit-hook addU
|
Exec = /usr/share/libalpm/scripts/dinit-user-hook addU
|
||||||
NeedsTargets
|
NeedsTargets
|
||||||
@@ -6,5 +6,5 @@ Target = etc/dinit.d/user/*
|
|||||||
[Action]
|
[Action]
|
||||||
Description = Displaying dinit user service help ...
|
Description = Displaying dinit user service help ...
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/share/libalpm/scripts/dinit-hook delU
|
Exec = /usr/share/libalpm/scripts/dinit-user-hook delU
|
||||||
NeedsTargets
|
NeedsTargets
|
||||||
@@ -66,20 +66,6 @@ case $op in
|
|||||||
del) svc_del_help ;;
|
del) svc_del_help ;;
|
||||||
addU) svc_user_add_help ;;
|
addU) svc_user_add_help ;;
|
||||||
delU) svc_user_del_help ;;
|
delU) svc_user_del_help ;;
|
||||||
userspawnE)
|
|
||||||
if dinit_live; then
|
|
||||||
/usr/bin/dinitctl enable dinit-user-spawn
|
|
||||||
else
|
|
||||||
/usr/bin/dinitctl enable -o dinit-user-spawn
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
userspawnD)
|
|
||||||
if dinit_live; then
|
|
||||||
/usr/bin/dinitctl disable dinit-user-spawn
|
|
||||||
else
|
|
||||||
/usr/bin/dinitctl disable -o dinit-user-spawn
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
|
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
20
dinit/scripts/user-spawn/dinit-user-spawn-hook
Normal file
20
dinit/scripts/user-spawn/dinit-user-spawn-hook
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
handle_user_spawn() {
|
||||||
|
if [ ! -S /run/dinitctl ]; then
|
||||||
|
echo >&2 " Current root is not booted."
|
||||||
|
dinitctl "$1" -o "$2"
|
||||||
|
else
|
||||||
|
dinitctl "$1" "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
op="$1"; shift
|
||||||
|
|
||||||
|
case $op in
|
||||||
|
enable) handle_user_spawn "$op" 'dinit-user-spawn' ;;
|
||||||
|
disable) handle_user_spawn "$op" 'dinit-user-spawn' ;;
|
||||||
|
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
28
dinit/scripts/user/dinit-user-hook
Normal file
28
dinit/scripts/user/dinit-user-hook
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
svc_help(){
|
||||||
|
echo " ==> Start/stop/restart a service:"
|
||||||
|
echo " dinitctl <start/stop/restart> <service>"
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_user_add_help(){
|
||||||
|
echo " ==> Add a user service:"
|
||||||
|
echo " $ dinitctl enable <service>"
|
||||||
|
svc_help
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_user_del_help(){
|
||||||
|
echo " ==> Remove a user service:"
|
||||||
|
echo " $ dinitctl disable <service>"
|
||||||
|
svc_help
|
||||||
|
}
|
||||||
|
|
||||||
|
op="$1"; shift
|
||||||
|
|
||||||
|
case $op in
|
||||||
|
addU) svc_user_add_help ;;
|
||||||
|
delU) svc_user_del_help ;;
|
||||||
|
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user