Skip to content

Commit 65dd0cd

Browse files
committed
Add option to revert to default KCL via ctrl-t in draw_be
1 parent 632b24f commit 65dd0cd

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

docs/pod/online/main-screen.pod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ The operation will fail gracefully if the pool can not be set I<read/write>.
3030

3131
Temporarily edit the kernel command line that will be used to boot the chosen kernel in the selected boot environment. This change does not persist across reboots.
3232

33+
=item I<[MOD+T]> B<revert kcl>
34+
35+
Revert the temporary kernel command line set via I<[MOD+E]>.
36+
3337
=item I<[MOD+P]> B<pool status>
3438

3539
View the health and status of each imported pool.

zfsbootmenu/bin/zfsbootmenu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ while true; do
282282
kcl_tokenize <<< "${cmdline}" | kcl_suppress root > "${BASE}/cmdline"
283283
fi
284284
;;
285+
"mod-t")
286+
[ -f "${BASE}/cmdline" ] && rm "${BASE}/cmdline"
287+
;;
285288
"mod-j")
286289
zfs_chroot "${selected_be}"
287290
;;

zfsbootmenu/help-files/132/main-screen.pod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
Temporarily edit the kernel command line that will be used to boot the chosen kernel in the selected boot environment. This change
2323
does not persist across reboots.
2424

25+
[MOD+T] revert kcl
26+
Revert the temporary kernel command line set via [MOD+E].
27+
2528
[MOD+P] pool status
2629
View the health and status of each imported pool.
2730

zfsbootmenu/help-files/52/main-screen.pod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
boot environment. This change does not persist
3232
across reboots.
3333

34+
[MOD+T] revert kcl
35+
Revert the temporary kernel command line set via
36+
[MOD+E].
37+
3438
[MOD+P] pool status
3539
View the health and status of each imported pool.
3640

zfsbootmenu/help-files/92/main-screen.pod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
Temporarily edit the kernel command line that will be used to boot the chosen kernel in
2525
the selected boot environment. This change does not persist across reboots.
2626

27+
[MOD+T] revert kcl
28+
Revert the temporary kernel command line set via [MOD+E].
29+
2730
[MOD+P] pool status
2831
View the health and status of each imported pool.
2932

zfsbootmenu/lib/zfsbootmenu-lib.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ column_wrap() {
6363
# returns: 0 on successful selection, 1 if Esc was pressed, 130 if BE list is missing
6464

6565
draw_be() {
66-
local env selected header expects
66+
local env selected header expects kcl_text kcl_bind blank
6767

6868
env="${1}"
6969
if [ -z "${env}" ]; then
@@ -78,17 +78,25 @@ draw_be() {
7878

7979
zdebug "using environment file: ${env}"
8080

81+
if [ -f "${BASE}/cmdline" ]; then
82+
kcl_text="[CTRL+T] revert kcl"
83+
kcl_bind="alt-t"
84+
blank=
85+
else
86+
blank=':'
87+
fi
88+
8189
header="$( column_wrap "\
8290
[RETURN] boot:[ESCAPE] refresh view:[CTRL+P] pool status
8391
[CTRL+D] set bootfs:[CTRL+S] snapshots:[CTRL+K] kernels
8492
[CTRL+E] edit kcl:[CTRL+J] jump into chroot:[CTRL+R] recovery shell
85-
[CTRL+L] view logs::[CTRL+H] help" \
93+
${kcl_text:+${kcl_text}:}[CTRL+L] view logs:${blank}[CTRL+H] help" \
8694
"\
8795
[RETURN] boot
8896
[CTRL+R] recovery shell
8997
[CTRL+H] help" )"
9098

91-
expects="--expect=alt-e,alt-k,alt-d,alt-s,alt-c,alt-r,alt-p,alt-w,alt-j,alt-o"
99+
expects="--expect=alt-e,alt-k,alt-d,alt-s,alt-c,alt-r,alt-p,alt-w,alt-j,alt-o${kcl_bind:+,${kcl_bind}}"
92100

93101
if ! selected="$( ${FUZZYSEL} -0 --prompt "BE > " \
94102
${expects} ${expects//alt-/ctrl-} ${expects//alt-/ctrl-alt-} \

0 commit comments

Comments
 (0)