Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zreport: handle hooks that run once and are completed #713

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion zfsbootmenu/lib/zfsbootmenu-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2029,13 +2029,20 @@ zreport() {

colorize orange "\n>> Enabled hooks\n"
for hook in /libexec/hooks/*.d/*; do
[ -x "${hook}" ] && echo "* $( colorize green "${hook}")"
ENABLED=
if [[ "${hook}" =~ \.completed$ ]] ; then
hook="${hook//.completed/ (run once, completed)}"
ENABLED=1
fi
[ -x "${hook}" ] && ENABLED=1
[ -n "${ENABLED}" ] && echo "* $( colorize green "${hook}")"
done

colorize orange "\n>> Disabled hooks\n"
for hook in /libexec/hooks/*.d/*; do
[ -f "${hook}" ] || continue
[ -x "${hook}" ] && continue
[[ "${hook}" =~ \.completed$ ]] && continue
echo "* $( colorize red "${hook}")"
done

Expand Down
1 change: 1 addition & 0 deletions zfsbootmenu/libexec/zfsbootmenu-run-hooks
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ for _hook in "/libexec/hooks/${hook_stage}"/*; do
if [ "${ONE_SHOT_HOOKS}" -eq 1 ] >/dev/null 2>&1; then
zinfo "Disabling hook after execution: ${_hook}"
chmod 000 "${_hook}"
mv "${_hook}" "${_hook}.completed"
fi
done

Expand Down
Loading