Skip to content
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
46 changes: 27 additions & 19 deletions 90zfsbootmenu/zfsbootmenu-parse-commandline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,45 @@ else
warn "ZFSBootMenu: Pools may not import correctly."
fi

# Use the last defined console= to control menu output
control_term=$( getarg console=)
if [ -n "${control_term}" ]; then
info "ZFSBootMenu: Setting controlling terminal to: ${control_term}"
control_term="/dev/${control_term}"
else
control_term="/dev/tty1"
info "ZFSBootMenu: Defaulting controlling terminal to: ${control_term}"
fi

# Use loglevel to determine logging to /dev/kmsg
loglevel=$( getarg loglevel=)
if [ -n "${loglevel}" ]; then
info "ZFSBootMenu: setting log level from command line: ${loglevel}"
else
loglevel=3
fi

# Force import pools only when explicitly told to do so
if getargbool 0 force_import ; then
if getargbool 0 zbm.force_import -d force_import ; then
# shellcheck disable=SC2034
force_import="yes"
info "ZFSBootMenu: Enabling force import of ZFS pools"
fi

# Set a menu timeout, to allow immediate booting
menu_timeout=$( getarg timeout=)
# zbm.timeout= overrides timeout=
menu_timeout=$( getarg zbm.timeout -d timeout )
if [ -n "${menu_timeout}" ]; then
info "ZFSBootMenu: Setting menu timeout from command line: ${menu_timeout}"
elif getargbool 0 zbm.show ; then
menu_timeout=-1;
info "ZFSBootMenu: forcing display of menu"
elif getargbool 0 zbm.skip ; then
menu_timeout=0;
info "ZFSBootMenu: skipping display of menu"
else
menu_timeout=10
fi

control_term=$( getarg console=)
if [ -n "${control_term}" ]; then
info "ZFSBootMenu: Setting controlling terminal to: ${control_term}"
control_term="/dev/${control_term}"
else
control_term="/dev/tty1"
info "ZFSBootMenu: Defaulting controlling terminal to: ${control_term}"
fi

# Allow setting of console size; there are no defaults here
# shellcheck disable=SC2034
zbm_lines=$( getarg zbm.lines=)
Expand All @@ -53,13 +68,6 @@ if getargbool 0 zbm.tmux ; then
info "ZFSBootMenu: Enabling tmux integrations"
fi

loglevel=$( getarg loglevel=)
if [ -n "${loglevel}" ]; then
info "ZFSBootMenu: setting log level from command line: ${loglevel}"
else
loglevel=3
fi

wait_for_zfs=0
case "${root}" in
""|zfsbootmenu|zfsbootmenu:)
Expand Down
24 changes: 16 additions & 8 deletions pod/zfsbootmenu.7.pod
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,50 @@ These options are set on the kernel command line when booting the initramfs or U

=over 4

=item B<root=zfsbootmenu:POOL=E<lt>poolE<gt>>

By default, ZFSBootMenu will look for the I<bootfs> property on the first pool it imports to select the default boot environment. If you have multiple pools, substitute the name of your preferred pool for B<E<lt>poolE<gt>> in the argument B<root=zfsbootmenu:POOL=E<lt>poolE<gt>>.

=item B<spl_hostid=E<lt>hostidE<gt>>

When creating an initramfs or UEFI bundle, the I<hostid> from the system is copied into the target. If this image will be used on another system with a different I<hostid>, it can be overridden with this option.

Replace B<E<lt>hostidE<gt>> with an eight-digit hexadecimal number.

=item B<force_import=1>
=item B<zbm.force_import=1>

Set this option to attempt to force pool imports. When set, this invokes I<zpool import -f> in place of the regular I<zpool import> command, which will attempt to import a pool that's potentially in use on another system. Use this option with caution!

Omit this option or explicitly specify B<force_import=0> to disable forced imports.
Omit this option or explicitly specify B<zbm.force_import=0> to disable forced imports.

=item B<timeout>
=item B<force_import=1>

Deprecated; use B<zbm.force_import>.

=item B<zbm.timeout>

This option accepts numeric values that control whether and when the
boot-environment menu should be displayed.

=over 2

=item B<timeout=0>
=item B<zbm.timeout=0> | B<zbm.skip>

When possible, bypass the menu and immediately boot a configured I<bootfs> pool property.

=item B<timeout=-1>
=item B<zbm.timeout=-1> | B<zbm.show>

Rather than present a countdown timer for automatic selection, immediately display the boot-environment menu.

=item B<timeout=E<lt>positive integerE<gt>>
=item B<zbm.timeout=E<lt>positive integerE<gt>>

Display a countdown timer for the specified number of seconds before booting the configured I<bootfs> boot environment.

=back

=item B<root=zfsbootmenu:POOL=E<lt>poolE<gt>>
=item B<timeout>

By default, ZFSBootMenu will look for the I<bootfs> property on the first pool it imports to select the default boot environment. If you have multiple pools, substitute the name of your preferred pool for B<E<lt>poolE<gt>> in the argument B<root=zfsbootmenu:POOL=E<lt>poolE<gt>>.
Deprecated; use B<zbm.timeout>.

=item B<zbm.tmux>

Expand Down
4 changes: 2 additions & 2 deletions testing/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ case "$(uname -m)" in
BIN="qemu-system-ppc64"
KERNEL="${TESTDIR}/vmlinux-bootmenu"
MACHINE="pseries,accel=kvm,kvm-type=HV,cap-hpt-max-page-size=4096"
APPEND="loglevel=7 timeout=5 root=zfsbootmenu:POOL=ztest"
APPEND="loglevel=7 zbm.timeout=5 root=zfsbootmenu:POOL=ztest"
SERDEV="hvc0"
;;
x86_64)
BIN="qemu-system-x86_64"
KERNEL="${TESTDIR}/vmlinuz-bootmenu"
MACHINE="type=q35,accel=kvm"
APPEND="loglevel=7 timeout=5 root=zfsbootmenu:POOL=ztest"
APPEND="loglevel=7 zbm.timeout=5 root=zfsbootmenu:POOL=ztest"
SERDEV="ttyS0"
;;
esac
Expand Down