From a89788e09c6b29810f433da096706062df04a7d5 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Tue, 9 Jul 2024 22:18:54 +0300 Subject: [PATCH] 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 --- mkinitramfs | 8 +++++++- mkinitramfs.8 | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 40e0fd1..be8d412 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -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 diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 9a3ddc1..ed9500c 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -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