Skip to content

Commit 989449c

Browse files
committed
zfsbootmenu: add zbm.kcl_override argument handler
1 parent 51cbdb2 commit 989449c

File tree

9 files changed

+88
-11
lines changed

9 files changed

+88
-11
lines changed

docs/man/dist/man5/generate-zbm.5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "GENERATE-ZBM" "5" "2022-12-19" "" "ZFSBootMenu"
30+
.TH "GENERATE-ZBM" "5" "2023-02-11" "" "ZFSBootMenu"
3131
.SH NAME
3232
generate-zbm \- configuration file for generate-zbm
3333
.SH SYNOPSIS
@@ -249,6 +249,6 @@ Kernel:
249249
.SH AUTHOR
250250
ZFSBootMenu Team <https://github.com/zbm-dev/zfsbootmenu>
251251
.SH COPYRIGHT
252-
2019, Zach Dykstra
252+
2019 Zach Dykstra, 2020-2023 ZFSBootMenu Team
253253
.\" Generated by docutils manpage writer.
254254
.

docs/man/dist/man7/zfsbootmenu.7

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "ZFSBOOTMENU" "7" "2022-12-19" "" "ZFSBootMenu"
30+
.TH "ZFSBOOTMENU" "7" "2023-02-11" "" "ZFSBootMenu"
3131
.SH NAME
3232
zfsbootmenu \- System Integration
3333
.SH SYNOPSIS
@@ -233,6 +233,23 @@ on the ZFSBootMenu command line. Note that any kernel modules necessary to mount
233233
Within the hook root, create subdirectories \fIearly\-setup.d\fP, \fIsetup.d\fP or \fIteardown.d\fP to hold hooks for the respective stages of hook execution (early\-setup, setup and teardown). ZFSBootMenu will mount the device named by the hook specification, look for the individual hook directories, and copy any files found therein into its own memory\-backed root filesystem. The copy is not recursive and further subdirectorie are ignored. Note that, because ZFSBootMenu copies these scripts into its standard hook paths at each boot, it is possible to \(dqmask\(dq a script explicitly included in the ZFSBootMenu image by including an external hook script with the same name in the appropriate directory.
234234
.UNINDENT
235235
.UNINDENT
236+
.sp
237+
\fBzbm.kcl_override=\(dqboot environment KCL\(dq\fP
238+
.INDENT 0.0
239+
.INDENT 3.5
240+
Override the kernel command line passed in to all boot environments. Double quotes must be used to encapsulate the value of this argument. Arguments that need spaces should be enclosed with single quotes. \fIroot\fP is always removed. \fIspl_hostid\fP and \fIspl.spl_hostid\fP are removed if the default\-enabled option \fIzbm.set_hostid\fP is set.
241+
.INDENT 0.0
242+
.INDENT 3.5
243+
.sp
244+
.nf
245+
.ft C
246+
zbm.kcl_override=\(dqsome alternate set=\(aqof arguments\(aq\(dq
247+
.ft P
248+
.fi
249+
.UNINDENT
250+
.UNINDENT
251+
.UNINDENT
252+
.UNINDENT
236253
.SH DEPRECATED COMMAND-LINE PARAMETERS
237254
.sp
238255
\fBtimeout\fP
@@ -444,6 +461,6 @@ By default, \fBmkinitcpio\fP uses busybox to populate initramfs images. However,
444461
.SH AUTHOR
445462
ZFSBootMenu Team <https://github.com/zbm-dev/zfsbootmenu>
446463
.SH COPYRIGHT
447-
2019, Zach Dykstra
464+
2019 Zach Dykstra, 2020-2023 ZFSBootMenu Team
448465
.\" Generated by docutils manpage writer.
449466
.

docs/man/dist/man8/generate-zbm.8

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "GENERATE-ZBM" "8" "2022-12-19" "" "ZFSBootMenu"
30+
.TH "GENERATE-ZBM" "8" "2023-02-11" "" "ZFSBootMenu"
3131
.SH NAME
3232
generate-zbm \- ZFSBootMenu initramfs generator
3333
.SH SYNOPSIS
@@ -136,14 +136,14 @@ Set the \fIGlobal.ManageImages\fP option to false, disabling image generation.
136136
.UNINDENT
137137
.UNINDENT
138138
.sp
139-
\fB\-\-debug|d\fP
139+
\fB\-\-debug|\-d\fP
140140
.INDENT 0.0
141141
.INDENT 3.5
142142
Enable debug output
143143
.UNINDENT
144144
.UNINDENT
145145
.sp
146-
\fB\-\-showver|V\fP
146+
\fB\-\-showver|\-V\fP
147147
.INDENT 0.0
148148
.INDENT 3.5
149149
Print ZFSBootMenu version and quit.
@@ -155,6 +155,6 @@ Print ZFSBootMenu version and quit.
155155
.SH AUTHOR
156156
ZFSBootMenu Team <https://github.com/zbm-dev/zfsbootmenu>
157157
.SH COPYRIGHT
158-
2019, Zach Dykstra
158+
2019 Zach Dykstra, 2020-2023 ZFSBootMenu Team
159159
.\" Generated by docutils manpage writer.
160160
.

docs/man/dist/man8/zbm-kcl.8

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "ZBM-KCL" "8" "2023-01-13" "" "ZFSBootMenu"
30+
.TH "ZBM-KCL" "8" "2023-02-11" "" "ZFSBootMenu"
3131
.SH NAME
3232
zbm-kcl \- manipulate kernel command lines for boot environments and EFI executables
3333
.SH SYNOPSIS
@@ -68,7 +68,7 @@ recorded in the property:
6868
.sp
6969
.nf
7070
.ft C
71-
zbm\-kcl \-a \(aqvariable="some argument with spaces"\(aq
71+
zbm\-kcl \-a \(aqvariable=\(dqsome argument with spaces\(dq\(aq
7272
.ft P
7373
.fi
7474
.UNINDENT
@@ -209,6 +209,6 @@ curl \-L https://get.zfsbootmenu.org/efi | \e
209209
.SH AUTHOR
210210
ZFSBootMenu Team <https://github.com/zbm-dev/zfsbootmenu>
211211
.SH COPYRIGHT
212-
2019, Zach Dykstra
212+
2019 Zach Dykstra, 2020-2023 ZFSBootMenu Team
213213
.\" Generated by docutils manpage writer.
214214
.

docs/man/zfsbootmenu.7.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ These options are set on the kernel command line when booting the initramfs or U
125125

126126
Within the hook root, create subdirectories *early-setup.d*, *setup.d* or *teardown.d* to hold hooks for the respective stages of hook execution (early-setup, setup and teardown). ZFSBootMenu will mount the device named by the hook specification, look for the individual hook directories, and copy any files found therein into its own memory-backed root filesystem. The copy is not recursive and further subdirectorie are ignored. Note that, because ZFSBootMenu copies these scripts into its standard hook paths at each boot, it is possible to "mask" a script explicitly included in the ZFSBootMenu image by including an external hook script with the same name in the appropriate directory.
127127

128+
**zbm.kcl_override="boot environment KCL"**
129+
130+
Override the kernel command line passed in to all boot environments. Double quotes must be used to encapsulate the value of this argument. Arguments that need spaces should be enclosed with single quotes. *root* is always removed. *spl_hostid* and *spl.spl_hostid* are removed if the default-enabled option *zbm.set_hostid* is set.
131+
132+
.. code-block::
133+
134+
zbm.kcl_override="some alternate set='of arguments'"
135+
128136
Deprecated Command-Line Parameters
129137
==================================
130138

zfsbootmenu/help-files/132/zfsbootmenu.7.ansi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@
146146
into its standard hook paths at each boot, it is possible to "mask" a script explicitly included in the ZFSBootMenu
147147
image by including an external hook script with the same name in the appropriate directory.
148148

149+
zbm.kcl_override="boot environment KCL"
150+
151+
Override the kernel command line passed in to all boot environments. Double quotes must be used to encapsulate the value of
152+
this argument. Arguments that need spaces should be enclosed with single quotes. root is always removed. spl_hostid and
153+
spl.spl_hostid are removed if the default-enabled option zbm.set_hostid is set.
154+
155+
zbm.kcl_override="some alternate set='of arguments'"
156+
149157
Deprecated Command-Line Parameters
150158

151159
timeout

zfsbootmenu/help-files/52/zfsbootmenu.7.ansi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,20 @@
246246
external hook script with the same name
247247
in the appropriate directory.
248248

249+
zbm.kcl_override="boot environment KCL"
250+
251+
Override the kernel command line passed in to
252+
all boot environments. Double quotes
253+
must be used to encapsulate the value of
254+
this argument. Arguments that need
255+
spaces should be enclosed with single
256+
quotes. root is always removed.
257+
spl_hostid and spl.spl_hostid are
258+
removed if the default-enabled option
259+
zbm.set_hostid is set.
260+
261+
zbm.kcl_override="some alternate set='of arguments'"
262+
249263
Deprecated Command-Line Parameters
250264

251265
timeout

zfsbootmenu/help-files/92/zfsbootmenu.7.ansi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@
171171
explicitly included in the ZFSBootMenu image by including an external hook
172172
script with the same name in the appropriate directory.
173173

174+
zbm.kcl_override="boot environment KCL"
175+
176+
Override the kernel command line passed in to all boot environments. Double quotes
177+
must be used to encapsulate the value of this argument. Arguments that need
178+
spaces should be enclosed with single quotes. root is always removed. spl_hostid
179+
and spl.spl_hostid are removed if the default-enabled option zbm.set_hostid is
180+
set.
181+
182+
zbm.kcl_override="some alternate set='of arguments'"
183+
174184
Deprecated Command-Line Parameters
175185

176186
timeout

zfsbootmenu/hook/zfsbootmenu-parse-commandline.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,26 @@ if prefer=$( get_zbm_arg zbm.prefer ) ; then
204204
root="zfsbootmenu:POOL=${prefer}"
205205
fi
206206

207+
if kcl_override=$( get_zbm_arg zbm.kcl_override ) ; then
208+
# Remove the leading / trailing quote to "unpack" this argument
209+
kcl_override="${kcl_override#\"}"
210+
kcl_override="${kcl_override%\"}"
211+
212+
# Up-convert single quotes to double, for kcl_tokenize
213+
kcl_override="${kcl_override//\'/\"}"
214+
215+
# Always strip root=
216+
rems+=( "root" )
217+
218+
# Only strip spl hostid arguments if zbm.set_hostid is enabled
219+
if [ "${zbm_set_hostid}" -eq 1 ] ; then
220+
rems+=( "spl_hostid" "spl.spl_hostid" )
221+
fi
222+
223+
kcl_tokenize <<< "${kcl_override}" | kcl_suppress "${rems[@]}" > "${BASE}/cmdline"
224+
zinfo "overriding all BE KCLs with: '$( kcl_assemble < "${BASE}/cmdline" )'"
225+
fi
226+
207227
wait_for_zfs=0
208228
case "${root}" in
209229
zfsbootmenu:POOL=*)

0 commit comments

Comments
 (0)