Skip to content

Commit

Permalink
set_default_kernel: properly clear default when no kernel is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
ahesford committed Dec 18, 2022
1 parent 7f929f1 commit 8e6ca4a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zfsbootmenu/lib/zfsbootmenu-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,20 @@ set_default_kernel() {
fi
zdebug "pool set to ${pool}"

# Strip /boot/ to list only the file
kernel="${2#/boot/}$"
zdebug "kernel set to ${kernel}"

# Make sure the pool is writable
set_rw_pool "${pool}" || return 1
CLEAR_SCREEN=1 load_key "${fs}"

# Strip /boot/ to list only the file
kernel="${2#/boot/}"

# Restore nonspecific default when no kernel specified
if [ -z "$kernel" ]; then
zdebug "clearing default kernel"
zfs inherit org.zfsbootmenu:kernel "${fs}" || return 1
else
zfs set org.zfsbootmenu:kernel="${kernel}" "${fs}" || return 1
zdebug "kernel set to ${kernel}"
zfs set org.zfsbootmenu:kernel="${kernel}$" "${fs}" || return 1
fi

return 0
Expand Down

0 comments on commit 8e6ca4a

Please sign in to comment.