forked from artix/alpm-hooks
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51cf1104bd | |||
| 89b170310d | |||
| 4937e1ee11 | |||
| b6e6922998 | |||
| 48b9a2a9ec | |||
| e14878b49c | |||
| 31f3dda786 | |||
| 09ef3fc619 | |||
| 9442565f14 |
@@ -7,5 +7,5 @@ Target = usr/lib/binfmt.d/*.conf
|
|||||||
[Action]
|
[Action]
|
||||||
Description = Registering binary formats...
|
Description = Registering binary formats...
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/share/libalpm/scripts/dinit-hook binfmt
|
Exec = /usr/lib/artix/binfmt.sh
|
||||||
NeedsTargets
|
NeedsTargets
|
||||||
@@ -46,7 +46,6 @@ op="$1"; shift
|
|||||||
|
|
||||||
case $op in
|
case $op in
|
||||||
sysctl) dinit_live; each_conf /usr/bin/sysctl -q -p ;;
|
sysctl) dinit_live; each_conf /usr/bin/sysctl -q -p ;;
|
||||||
binfmt) dinit_live; /usr/bin/dinitctl restart binfmt ;;
|
|
||||||
dbus_reload) dinit_live; reload_dbus ;;
|
dbus_reload) dinit_live; reload_dbus ;;
|
||||||
# For use by other packages
|
# For use by other packages
|
||||||
reload) dinit_live; /usr/bin/dinitctl reload "$@"; /usr/bin/dinitctl restart "$@" ;;
|
reload) dinit_live; /usr/bin/dinitctl reload "$@"; /usr/bin/dinitctl restart "$@" ;;
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ Operation = Upgrade
|
|||||||
Target = openrc
|
Target = openrc
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Description = Reexecuting init ...
|
Description = Configuring user service & reexecuting init ...
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/share/libalpm/scripts/openrc-hook reexec
|
Exec = /usr/share/libalpm/scripts/openrc-hook reexec
|
||||||
|
|||||||
11
openrc/hooks/openrc-user-install.hook
Normal file
11
openrc/hooks/openrc-user-install.hook
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[Trigger]
|
||||||
|
Type = Path
|
||||||
|
Operation = Install
|
||||||
|
Operation = Upgrade
|
||||||
|
Target = etc/user/init.d/*
|
||||||
|
|
||||||
|
[Action]
|
||||||
|
Description = Displaying openrc user service help ...
|
||||||
|
When = PostTransaction
|
||||||
|
Exec = /usr/share/libalpm/scripts/openrc-hook uadd
|
||||||
|
NeedsTargets
|
||||||
10
openrc/hooks/openrc-user-remove.hook
Normal file
10
openrc/hooks/openrc-user-remove.hook
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[Trigger]
|
||||||
|
Type = Path
|
||||||
|
Operation = Remove
|
||||||
|
Target = etc/user/init.d/*
|
||||||
|
|
||||||
|
[Action]
|
||||||
|
Description = Displaying openrc user service help ...
|
||||||
|
When = PostTransaction
|
||||||
|
Exec = /usr/share/libalpm/scripts/openrc-hook udel
|
||||||
|
NeedsTargets
|
||||||
@@ -24,6 +24,37 @@ svc_del_help(){
|
|||||||
svc_help
|
svc_help
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svc_user_help(){
|
||||||
|
echo " ==> Start/stop/restart a service:"
|
||||||
|
echo " rc-service -U <service> <start/stop/restart>"
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_user_add_help(){
|
||||||
|
echo " ==> Add a user service to runlevel:"
|
||||||
|
echo " rc-update -U add <service> <runlevel>"
|
||||||
|
svc_help
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_user_del_help(){
|
||||||
|
echo " ==> Remove a user service from runlevel:"
|
||||||
|
echo " rc-update -U del <service> <runlevel>"
|
||||||
|
svc_help
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_user_ln() {
|
||||||
|
umin=$(grep "^UID_MIN" /etc/login.defs)
|
||||||
|
umax=$(grep "^UID_MAX" /etc/login.defs)
|
||||||
|
users=$(awk -F':' -v "min=${umin##UID_MIN}" -v "max=${umax##UID_MAX}" \
|
||||||
|
'{ if ( $3 >= min && $3 <= max ) print $0 }' /etc/passwd \
|
||||||
|
| cut -d: -f1)
|
||||||
|
|
||||||
|
for u in $users; do
|
||||||
|
if [ ! -e /etc/init.d/user.$u ]; then
|
||||||
|
ln -sv /etc/init.d/user /etc/init.d/user.$u
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
each_conf() {
|
each_conf() {
|
||||||
while read -r f; do
|
while read -r f; do
|
||||||
"$@" "/$f"
|
"$@" "/$f"
|
||||||
@@ -35,11 +66,13 @@ op="$1"; shift
|
|||||||
case $op in
|
case $op in
|
||||||
sysctl) openrc_live; each_conf /usr/bin/sysctl -q -p ;;
|
sysctl) openrc_live; each_conf /usr/bin/sysctl -q -p ;;
|
||||||
binfmt) openrc_live; each_conf /usr/lib/openrc/sh/binfmt.sh ;;
|
binfmt) openrc_live; each_conf /usr/lib/openrc/sh/binfmt.sh ;;
|
||||||
reexec) openrc_live; /usr/bin/openrc-shutdown -R ;;
|
reexec) svc_user_ln; openrc_live; /usr/bin/openrc-shutdown -R ;;
|
||||||
# For use by other packages
|
# For use by other packages
|
||||||
reload) openrc_live; /usr/bin/rc-service "$@" reload ;;
|
reload) openrc_live; /usr/bin/rc-service "$@" reload ;;
|
||||||
add) svc_add_help ;;
|
add) svc_add_help ;;
|
||||||
del) svc_del_help ;;
|
del) svc_del_help ;;
|
||||||
|
uadd) svc_user_add_help ;;
|
||||||
|
udel) svc_user_del_help ;;
|
||||||
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
|
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
[Trigger]
|
|
||||||
Type = Path
|
|
||||||
Operation = Install
|
|
||||||
Operation = Upgrade
|
|
||||||
Target = usr/lib/binfmt.d/*.conf
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Description = Registering binary formats...
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/share/libalpm/scripts/runit-hook binfmt
|
|
||||||
NeedsTargets
|
|
||||||
@@ -34,7 +34,6 @@ op="$1"; shift
|
|||||||
|
|
||||||
case $op in
|
case $op in
|
||||||
sysctl) runit_live; each_conf /usr/bin/sysctl -q -p ;;
|
sysctl) runit_live; each_conf /usr/bin/sysctl -q -p ;;
|
||||||
binfmt) runit_live; each_conf /usr/lib/rc/sv.d/binfmt once ;;
|
|
||||||
# For use by other packages
|
# For use by other packages
|
||||||
reload) runit_live; /usr/bin/sv "$@" reload ;;
|
reload) runit_live; /usr/bin/sv "$@" reload ;;
|
||||||
add) svc_add_help ;;
|
add) svc_add_help ;;
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
[Trigger]
|
|
||||||
Type = Path
|
|
||||||
Operation = Install
|
|
||||||
Operation = Upgrade
|
|
||||||
Target = usr/lib/binfmt.d/*.conf
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Description = Registering binary formats...
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/share/libalpm/scripts/s6-rc-hook binfmt
|
|
||||||
NeedsTargets
|
|
||||||
@@ -51,7 +51,6 @@ op="$1"; shift
|
|||||||
|
|
||||||
case $op in
|
case $op in
|
||||||
sysctl) s6_live; each_conf /usr/bin/sysctl -q -p ;;
|
sysctl) s6_live; each_conf /usr/bin/sysctl -q -p ;;
|
||||||
binfmt) s6_live; sh /etc/s6/sv/binfmt/shell_up ;;
|
|
||||||
dbus_reload) s6_live; reload_dbus ;;
|
dbus_reload) s6_live; reload_dbus ;;
|
||||||
# For use by other packages
|
# For use by other packages
|
||||||
add) svc_add_help ;;
|
add) svc_add_help ;;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ cmds_s6() {
|
|||||||
cmds_dinit() {
|
cmds_dinit() {
|
||||||
COMMANDS[start]="dinitctl start ${SV}"
|
COMMANDS[start]="dinitctl start ${SV}"
|
||||||
COMMANDS[stop]="dinitctl stop ${SV}"
|
COMMANDS[stop]="dinitctl stop ${SV}"
|
||||||
COMMANDS[enable]="ln -s /etc/dinit.d/${SV} /etc/dinit.d/boot.d/"
|
COMMANDS[enable]="dinitctl -o enable ${SV}"
|
||||||
COMMANDS[disable]="rm /etc/dinit.d/boot.d/${SV}"
|
COMMANDS[disable]="dinitctl -o disable ${SV}"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmds_runit() {
|
cmds_runit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user