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 2, 2024
1 parent 0eeecb5 commit 517af46
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions zfsbootmenu/bin/zfsbootmenu
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,27 @@ 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

zdebug "exited while waiting for initialization"
if ! timed_prompt -d 0 \
-m "$( colorize red "ZFSBootMenu must be initialized to continue" )" \
-r "initialize" \
-e "abort "; then
zdebug "aborted while waiting for initialization"
tput cnorm
tput clear
exit
fi

tput cnorm
tput clear
[ -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 517af46

Please sign in to comment.