diff --git a/docs/online/recovery-shell.rst b/docs/online/recovery-shell.rst index 9db9bffba..a7e68c0af 100644 --- a/docs/online/recovery-shell.rst +++ b/docs/online/recovery-shell.rst @@ -51,3 +51,11 @@ Common Commands **logs** View warning/error/debug logs. + +**shutdown**|**poweroff** + + Shutdown the system using a SysRq magic invocation. + +**reboot** + + Reboot the system using a SysRq magic invocation. diff --git a/zfsbootmenu/bin/poweroff b/zfsbootmenu/bin/poweroff new file mode 120000 index 000000000..dde059f3e --- /dev/null +++ b/zfsbootmenu/bin/poweroff @@ -0,0 +1 @@ +reboot \ No newline at end of file diff --git a/zfsbootmenu/bin/reboot b/zfsbootmenu/bin/reboot new file mode 100755 index 000000000..ad150a26e --- /dev/null +++ b/zfsbootmenu/bin/reboot @@ -0,0 +1,42 @@ +#!/bin/bash +# vim: softtabstop=2 shiftwidth=2 expandtab + +# shellcheck disable=SC1091 +sources=( + /lib/kmsg-log-lib.sh + /lib/zfsbootmenu-core.sh +) + +for src in "${sources[@]}"; do + # shellcheck disable=SC1090 + if ! source "${src}" >/dev/null 2>&1 ; then + echo -e "\033[0;31mWARNING: ${src} was not sourced; unable to proceed\033[0m" + exit 1 + fi +done + +unset src sources + +case "${0##*/}" in + reboot) + trigger="b" + ;; + shutdown|poweroff) + trigger="o" + ;; + *) + exit + ;; +esac + +while read -r _pool; do + is_writable "${_pool}" && export_pool "${_pool}" +done <<<"$( zpool list -H -o name )" + +sysrq="/proc/sysrq-trigger" +if [ -e "${sysrq}" ] && [ -w "${sysrq}" ]; then + echo "${trigger}" > /proc/sysrq-trigger +else + echo "${sysrq} does not exist, hard reset system" + exit 1 +fi diff --git a/zfsbootmenu/bin/shutdown b/zfsbootmenu/bin/shutdown new file mode 120000 index 000000000..dde059f3e --- /dev/null +++ b/zfsbootmenu/bin/shutdown @@ -0,0 +1 @@ +reboot \ No newline at end of file diff --git a/zfsbootmenu/help-files/132/recovery-shell.ansi b/zfsbootmenu/help-files/132/recovery-shell.ansi index 72e266d76..f5edabdd4 100644 --- a/zfsbootmenu/help-files/132/recovery-shell.ansi +++ b/zfsbootmenu/help-files/132/recovery-shell.ansi @@ -51,3 +51,11 @@ logs View warning/error/debug logs. + + shutdown**|**poweroff + + Shutdown the system using a SysRq magic invocation. + + reboot + + Reboot the system using a SysRq magic invocation. diff --git a/zfsbootmenu/help-files/132/zfsbootmenu.7.ansi b/zfsbootmenu/help-files/132/zfsbootmenu.7.ansi index b7f51d3a3..71ba61337 100644 --- a/zfsbootmenu/help-files/132/zfsbootmenu.7.ansi +++ b/zfsbootmenu/help-files/132/zfsbootmenu.7.ansi @@ -162,6 +162,11 @@ NOTE: The hooklist argument MUST NOT contain spaces and MUST NOT be enclosed in quotes. + zbm.autosize + + Enable automatic font resizing of the kernel console to normalize the apparent resolution for both low resolution and high + resolution displays. This option is enabled by default. + Deprecated Parameters timeout @@ -344,7 +349,7 @@ Boot-selection hooks will be installed from the directory ${zfsbootmenu_hook_root}/boot-sel.d. These hooks will be executed after a user has selected a boot environment, but before ZFSBootMenu attempts to load and boot the kernel. - Teardown hooks will be installed from the directory ${zfsbootmenu_hook_root}/teardown.d. These hooks will be exectued after + Teardown hooks will be installed from the directory ${zfsbootmenu_hook_root}/teardown.d. These hooks will be executed after the kernel for a selected environment has been loaded and is launching via kexec is imminent. Some hardware initialized by the ZFSBootMenu kernel may not be properly reinitialized when a boot environment is launched; teardown hooks may be useful to unbind drivers from problematic hardware or remove associated kernel modules. @@ -364,9 +369,16 @@ The path to the initramfs corresponding to the selected kernel, again relative to the root of ZBM_SELECTED_BE. - No boot-selection or teardown hook should assume that the filesystem named in ZBM_SELECTED_BE is currently mounted. In - addition, no teardown hook should assume that the ZFSBootMenu environment is in a consistent operating state. - ZFSBootMenu may have exported some or all pools prior to executing teardown hooks. + Additionally, boot-selection hooks will have access to a fourth environment variable: + + ZBM_SELECTED_MOUNTPOINT + + The path where the selected boot environment is currently mounted, which is the root relative to which ZFSBootMenu will + attempt to load the selected kernel and initramfs. + + Teardown hooks should never assume that the filesystem named in ZBM_SELECTED_BE is currently mounted. In addition, no teardown + hook should assume that the ZFSBootMenu environment is in a consistent operating state. ZFSBootMenu may have exported + some or all pools prior to executing teardown hooks. In general, it is not possible to cleanly abort a boot attempt from boot-selection or teardown hooks. However, a boot-selection or teardown hook may take control of the boot attempt by implementing its own kexec load and execution diff --git a/zfsbootmenu/help-files/52/recovery-shell.ansi b/zfsbootmenu/help-files/52/recovery-shell.ansi index ad08c45ea..d34fd5f3a 100644 --- a/zfsbootmenu/help-files/52/recovery-shell.ansi +++ b/zfsbootmenu/help-files/52/recovery-shell.ansi @@ -62,3 +62,13 @@ logs View warning/error/debug logs. + + shutdown**|**poweroff + + Shutdown the system using a SysRq magic + invocation. + + reboot + + Reboot the system using a SysRq magic + invocation. diff --git a/zfsbootmenu/help-files/52/zfsbootmenu.7.ansi b/zfsbootmenu/help-files/52/zfsbootmenu.7.ansi index 63c612940..a458a3a8f 100644 --- a/zfsbootmenu/help-files/52/zfsbootmenu.7.ansi +++ b/zfsbootmenu/help-files/52/zfsbootmenu.7.ansi @@ -274,6 +274,14 @@ spaces and MUST NOT be enclosed in quotes. + zbm.autosize + + Enable automatic font resizing of the kernel + console to normalize the apparent + resolution for both low resolution and + high resolution displays. This option is + enabled by default. + Deprecated Parameters timeout @@ -596,7 +604,7 @@ Teardown hooks will be installed from the directory ${zfsbootmenu_hook_root}/- - teardown.d. These hooks will be exectued + teardown.d. These hooks will be executed after the kernel for a selected environment has been loaded and is launching via kexec is imminent. Some @@ -630,11 +638,22 @@ the selected kernel, again relative to the root of ZBM_SELECTED_BE. - No boot-selection or teardown hook should - assume that the filesystem named in - ZBM_SELECTED_BE is currently mounted. In - addition, no teardown hook should assume - that the ZFSBootMenu environment is in a + Additionally, boot-selection hooks will have + access to a fourth environment variable: + + ZBM_SELECTED_MOUNTPOINT + + The path where the selected boot environment + is currently mounted, which is the + root relative to which ZFSBootMenu + will attempt to load the selected + kernel and initramfs. + + Teardown hooks should never assume that the + filesystem named in ZBM_SELECTED_BE is + currently mounted. In addition, no + teardown hook should assume that the + ZFSBootMenu environment is in a consistent operating state. ZFSBootMenu may have exported some or all pools prior to executing teardown hooks. diff --git a/zfsbootmenu/help-files/92/recovery-shell.ansi b/zfsbootmenu/help-files/92/recovery-shell.ansi index 0f21b11fc..77100cc11 100644 --- a/zfsbootmenu/help-files/92/recovery-shell.ansi +++ b/zfsbootmenu/help-files/92/recovery-shell.ansi @@ -52,3 +52,11 @@ logs View warning/error/debug logs. + + shutdown**|**poweroff + + Shutdown the system using a SysRq magic invocation. + + reboot + + Reboot the system using a SysRq magic invocation. diff --git a/zfsbootmenu/help-files/92/zfsbootmenu.7.ansi b/zfsbootmenu/help-files/92/zfsbootmenu.7.ansi index d12969b00..419dbe123 100644 --- a/zfsbootmenu/help-files/92/zfsbootmenu.7.ansi +++ b/zfsbootmenu/help-files/92/zfsbootmenu.7.ansi @@ -191,6 +191,12 @@ NOTE: The hooklist argument MUST NOT contain spaces and MUST NOT be enclosed in quotes. + zbm.autosize + + Enable automatic font resizing of the kernel console to normalize the apparent + resolution for both low resolution and high resolution displays. This option is + enabled by default. + Deprecated Parameters timeout @@ -414,7 +420,7 @@ boot the kernel. Teardown hooks will be installed from the directory - ${zfsbootmenu_hook_root}/teardown.d. These hooks will be exectued after the + ${zfsbootmenu_hook_root}/teardown.d. These hooks will be executed after the kernel for a selected environment has been loaded and is launching via kexec is imminent. Some hardware initialized by the ZFSBootMenu kernel may not be properly reinitialized when a boot environment is launched; teardown hooks may @@ -437,11 +443,18 @@ The path to the initramfs corresponding to the selected kernel, again relative to the root of ZBM_SELECTED_BE. - No boot-selection or teardown hook should assume that the filesystem named in - ZBM_SELECTED_BE is currently mounted. In addition, no teardown hook should - assume that the ZFSBootMenu environment is in a consistent operating state. - ZFSBootMenu may have exported some or all pools prior to executing teardown - hooks. + Additionally, boot-selection hooks will have access to a fourth environment variable: + + ZBM_SELECTED_MOUNTPOINT + + The path where the selected boot environment is currently mounted, which is the root + relative to which ZFSBootMenu will attempt to load the selected kernel and + initramfs. + + Teardown hooks should never assume that the filesystem named in ZBM_SELECTED_BE is + currently mounted. In addition, no teardown hook should assume that the + ZFSBootMenu environment is in a consistent operating state. ZFSBootMenu may have + exported some or all pools prior to executing teardown hooks. In general, it is not possible to cleanly abort a boot attempt from boot-selection or teardown hooks. However, a boot-selection or teardown hook may take control of