aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/procd/files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-01-30 19:37:41 +0000
committerDaniel Golle <daniel@makrotopia.org>2022-01-30 20:16:25 +0000
commit6d76ec38721f964ae9ac65d80ef8628199986fa4 (patch)
treefd75261b37770e147264aff3dbcdde3c73df9fe3 /package/system/procd/files
parentb21bc3479d46e6a4c3cc6bf7c245d4b0ddccb7db (diff)
downloadupstream-6d76ec38721f964ae9ac65d80ef8628199986fa4.tar.gz
upstream-6d76ec38721f964ae9ac65d80ef8628199986fa4.tar.bz2
upstream-6d76ec38721f964ae9ac65d80ef8628199986fa4.zip
procd: support generic mount triggers and clean up
Allow init scripts to trigger free-form actions by exposing procd_add_action_mount_trigger. Clean up mount trigger wrappers while at it to reduce code duplication. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/system/procd/files')
-rw-r--r--package/system/procd/files/procd.sh20
1 files changed, 9 insertions, 11 deletions
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index 2284f55ed2..5148b2f03c 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -363,14 +363,15 @@ _procd_add_mount_trigger() {
}
_procd_add_action_mount_trigger() {
- local script=$(readlink "$initscript")
- local name=$(basename ${script:-$initscript})
local action="$1"
- local mpath
shift
+ local mountpoints="$(procd_get_mountpoints "$@")"
+ [ "${mountpoints//[[:space:]]}" ] || return 0
+ local script=$(readlink "$initscript")
+ local name=$(basename ${script:-$initscript})
_procd_open_trigger
- _procd_add_mount_trigger mount.add $action "$@"
+ _procd_add_mount_trigger mount.add $action "$mountpoints"
_procd_close_trigger
}
@@ -384,7 +385,7 @@ procd_get_mountpoints() {
target="${target%%/}/"
[ "$path" != "${path##$target}" ] && echo "${target%%/}"
}
-
+ local mpath
config_load fstab
for mpath in "$@"; do
config_foreach __procd_check_mount mount "$mpath"
@@ -393,15 +394,11 @@ procd_get_mountpoints() {
}
_procd_add_restart_mount_trigger() {
- local mountpoints="$(procd_get_mountpoints "$@")"
- [ "${mountpoints//[[:space:]]}" ] &&
- _procd_add_action_mount_trigger restart $mountpoints
+ _procd_add_action_mount_trigger restart "$@"
}
_procd_add_reload_mount_trigger() {
- local mountpoints="$(procd_get_mountpoints "$@")"
- [ "${mountpoints//[[:space:]]}" ] &&
- _procd_add_action_mount_trigger reload $mountpoints
+ _procd_add_action_mount_trigger reload "$@"
}
_procd_add_raw_trigger() {
@@ -638,6 +635,7 @@ _procd_wrapper \
procd_add_mount_trigger \
procd_add_reload_trigger \
procd_add_reload_interface_trigger \
+ procd_add_action_mount_trigger \
procd_add_reload_mount_trigger \
procd_add_restart_mount_trigger \
procd_open_trigger \