Skip to content

Commit

Permalink
Fix edge cases
Browse files Browse the repository at this point in the history
If zpool is set to a non-existent pool on the kernel command line, we
incorrectly handle setting a kernel mask in select_kernel.

This also simplifies setting BOOTFS, so we should now always have it
correctly set, or empty.

Add the 'ip' tool, so you can set an IP and zfs send/recv in the
bootloader.
  • Loading branch information
zdykstra committed Dec 10, 2019
1 parent af408a9 commit 8554bdd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions 90zfsbootmenu/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ install() {
dracut_install tput
dracut_install mount
dracut_install df
dracut_install ip
dracut_install /usr/bin/timeout
dracut_install /usr/bin/mkdir
dracut_install /usr/bin/tail
Expand Down
13 changes: 5 additions & 8 deletions 90zfsbootmenu/zfsbootmenu-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ kexec_kernel() {

umount_zfs ${fs}

if ! [ $? -eq 0 ]; then
emergency_shell "unable to export pools"
fi

kexec -e -i
}

Expand Down Expand Up @@ -239,13 +235,14 @@ find_be_kernels() {
# returns: nothing

select_kernel() {
local fs
fs="${1}"
local zfsbe
zfsbe="${1}"

local sane specific_kernel kexec_args
sane="$( underscore ${fs} )"
sane="$( underscore ${zfsbe} )"

specific_kernel="$( zfs get -H -o value org.zfsbootmenu:kernel ${BOOTFS} )"
specific_kernel="$( zfs get -H -o value org.zfsbootmenu:kernel ${zfsbe} )"

# No value set, pick the last kernel entry
if [ "${specific_kernel}" = "-" ]; then
kexec_args="$( tail -1 ${BASE}/${sane} )"
Expand Down
12 changes: 6 additions & 6 deletions 90zfsbootmenu/zfsbootmenu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ fi

# Attempt to find the bootfs property
datasets="$( zpool list -H -o bootfs ${pool} )"
if [ "$datasets" = "-" ]; then
BOOTFS=
else
while read -r line; do
while read -r line; do
if [ "${line}" = "-" ]; then
BOOTFS=
else
BOOTFS="${line}"
break
done <<<"${datasets}"
fi
fi
done <<<"${datasets}"

# If BOOTFS is not empty display the fast boot menu
fast_boot=0
Expand Down

0 comments on commit 8554bdd

Please sign in to comment.