This has *not* been tested. I just wanted to see if there'd be any interest. "cleanup_hook" is run in the reverse order of run_hooks, if available. This would be useful to the dropbear hook in AUR. I know systemd is killing off processes automatically, but even if initcpio/initscripts started doing this, dropbear still sets up a network interface. Unlike the net hook, dropbear's setup is meant to be undone. diff --git i/init w/init index 1f5f865..e9a6924 100644 --- i/init +++ w/init @@ -43,33 +43,48 @@ fi if [ -e "/hooks" ]; then for h in ${HOOKS}; do TST="" eval "TST=\$hook_${h}" if [ "${TST}" != "disabled" ]; then run_hook () { msg "${h}: no run function defined"; } if [ -e "/hooks/${h}" ]; then . /hooks/${h} msg ":: Running Hook [${h}]" run_hook fi fi done + + for h in $(echo -n "${HOOKS} " | tac -s' '); do + TST="" + eval "TST=\$hook_${h}" + if [ "${TST}" != "disabled" ]; then + unset cleanup_hook + if [ -e "/hooks/${h}" ]; then + . /hooks/${h} + if [ "$(type -t foo 2>/dev/null)" == function ]; then + msg ":: Running Hook Cleanup [${h}]" + cleanup_hook + fi + fi + fi + done fi # honor the old behavior of break=y as a synonym for break=premount