Skip to content

Commit

Permalink
zfsbootmenu: attempt initialization if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ahesford committed Mar 1, 2024
1 parent 8dfb713 commit 909d687
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zfsbootmenu/bin/zfsbootmenu
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,24 @@ unset src sources
mkdir -p "${BASE:=/zfsbootmenu}"

while [ ! -e "${BASE}/initialized" ]; do
if ! timed_prompt -d 5 -e "to cancel" \
-p "Waiting for ZFSBootMenu initialization"; then

if ! timed_prompt -d 10 -e "to cancel" -r "to try immediately" \
-m "$( colorize red "ZFSBootMenu is not yet initialized" )" \
-p "will attempt re-initialization in $( colorize yellow "%0.2d" ) seconds"; then
zdebug "exited while waiting for initialization"
tput cnorm
tput clear
exit
fi

[ -e "${BASE}/initialized" ] || /libexec/zfsbootmenu-init
done

[ -e "${BASE}/active" ] && takeover

# If the takeover fails for some reason, spin until it ends
while [ -e "${BASE}/active" ]; do
if ! timed_prompt -d 1 -e "to cancel" \
-p "Waiting for other ZFSBootMenu instance to terminate"; then

-p "Waiting for other ZFSBootMenu instance to terminate"; then
zdebug "exited while waiting to own ${BASE}/active"
tput cnorm
tput clear
Expand Down

0 comments on commit 909d687

Please sign in to comment.