mkinitramfs: Add -m argument to override MODULES setting

We shouldn't need to change the system configuration to test changes to
initramfs-tools. It's possible to use the -d argument with a custom
config directory this purpose, but testing different MODULES settings is
necessary frequently enough that it deserves its own shortcut. Add a -m
argument to mkinitramfs that overrides the MODULES setting.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
Alper Nebi Yasak 2024-07-09 22:18:54 +03:00
parent 84e5c0f7da
commit a89788e09c
2 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,7 @@ Options:
-c compress Override COMPRESS setting in initramfs.conf.
-d confdir Specify an alternative configuration directory.
-l level Override COMPRESSLEVEL setting in initramfs.conf.
-m modules Override MODULES setting in initramfs.conf.
-k Keep temporary directory used to make the image.
-o outfile Write to outfile.
-r root Override ROOT setting in initramfs.conf.
@ -36,7 +37,7 @@ usage_error()
exit 2
}
OPTIONS=$(getopt -o c:d:hl:ko:r:v --long help -n "$0" -- "$@") || usage_error
OPTIONS=$(getopt -o c:d:hl:m:ko:r:v --long help -n "$0" -- "$@") || usage_error
eval set -- "$OPTIONS"
@ -62,6 +63,10 @@ while true; do
compresslevel="$2"
shift 2
;;
-m)
modules="$2"
shift 2
;;
-o)
outfile="$2"
shift 2
@ -257,6 +262,7 @@ if [ -d "${outfile}" ]; then
exit 1
fi
MODULES="${modules:-$MODULES}"
MODULESDIR="/lib/modules/${version}"
if [ ! -e "${MODULESDIR}" ]; then

View File

@ -55,6 +55,13 @@ Override the
setting in
.IR initramfs.conf .
.TP
\fB\-m \fI modules
Override the
.B MODULES
setting in
.IR initramfs.conf .
.TP
\fB\-o \fI outfile
Write the image to