4 Commits
2.2 ... 2.4

5 changed files with 69 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = etc/dinit.d/user/*
[Action]
Description = Displaying dinit user service help ...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/dinit-hook addU
NeedsTargets

View File

@@ -0,0 +1,10 @@
[Trigger]
Type = Path
Operation = Remove
Target = etc/dinit.d/user/*
[Action]
Description = Displaying dinit user service help ...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/dinit-hook delU
NeedsTargets

View File

@@ -0,0 +1,11 @@
[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

View File

@@ -0,0 +1,10 @@
[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

View File

@@ -14,13 +14,25 @@ svc_help(){
svc_add_help(){
echo " ==> Add a service:"
echo " dinitctl enable <service>"
echo " # dinitctl enable <service>"
svc_help
}
svc_del_help(){
echo " ==> Remove a service:"
echo " dinitctl disable <service>"
echo " # dinitctl disable <service>"
svc_help
}
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
}
@@ -42,6 +54,15 @@ restart_service() {
fi
}
handle_user_spawn() {
if [ ! -S /run/dinitctl ]; then
echo >&2 " Current root is not booted."
dinitctl "$1" -o dinit-user-spawn
else
dinitctl "$1" dinit-user-spawn
fi
}
op="$1"; shift
case $op in
@@ -52,6 +73,10 @@ case $op in
restart) dinit_live; restart_service "$1" ;;
add) svc_add_help ;;
del) svc_del_help ;;
addU) svc_user_add_help ;;
delU) svc_user_del_help ;;
userspawnE) handle_user_spawn enable ;;
userspawnD) handle_user_spawn disable ;;
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
esac