]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
feat(lsinitrd.sh): print stored dracut cmdline
authorSteffen Maier <maier@linux.ibm.com>
Fri, 10 Feb 2023 17:37:55 +0000 (18:37 +0100)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Tue, 16 Apr 2024 00:35:20 +0000 (20:35 -0400)
It's more convenient for debugging than extracting or unpacking the
corresponding files.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
lsinitrd.sh

index 25640ee1610bb1e486c943df8e9a654795c42980..1329ab70be4f208bd36241e3f8d9ed665b8d9d8a 100755 (executable)
@@ -233,6 +233,25 @@ list_squash_content() {
     fi
 }
 
+list_cmdline() {
+    # depends on list_squash_content() having run before
+    SQUASH_IMG="squash-root.img"
+    SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
+    SQUASH_EXTRACT="$TMPDIR/squash-extract"
+
+    echo "dracut cmdline:"
+    # shellcheck disable=SC2046
+    $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
+        etc/cmdline.d/\*.conf 2> /dev/null
+    ((ret += $?))
+    if [[ -s $SQUASH_TMPFILE ]]; then
+        unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" etc/cmdline.d/\*.conf > /dev/null 2>&1
+        ((ret += $?))
+        cat "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null
+        rm "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null
+    fi
+}
+
 unpack_files() {
     SQUASH_IMG="squash-root.img"
     SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
@@ -422,6 +441,8 @@ else
         list_modules
         list_files
         list_squash_content
+        echo
+        list_cmdline
     fi
 fi