teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 33864.patch

53118d
From 94a2999f250e3f7579883f5c79815b80398043cd Mon Sep 17 00:00:00 2001
53118d
From: Daan De Meyer <daan.j.demeyer@gmail.com>
53118d
Date: Mon, 29 Jul 2024 17:13:28 +0200
53118d
Subject: [PATCH] kernel-install: Only read cmdline from /proc/cmdline when not
53118d
 in container
53118d
53118d
If we're running from within a container, we're very likely not going
53118d
to want to use the kernel command line from /proc/cmdline, so let's add
53118d
a check to see if we're running from a container to decide whether we'll
53118d
use the kernel command line from /proc/cmdline.
53118d
---
53118d
 src/kernel-install/90-loaderentry.install.in | 6 ++++--
53118d
 1 file changed, 4 insertions(+), 2 deletions(-)
53118d
53118d
diff --git a/src/kernel-install/90-loaderentry.install.in b/src/kernel-install/90-loaderentry.install.in
53118d
index 4ef6aca169c1a..79427684cc5c9 100755
53118d
--- a/src/kernel-install/90-loaderentry.install.in
53118d
+++ b/src/kernel-install/90-loaderentry.install.in
53118d
@@ -79,8 +79,10 @@ elif [ -f /etc/kernel/cmdline ]; then
53118d
     BOOT_OPTIONS="$(tr -s "$IFS" ' ' 
53118d
 elif [ -f /usr/lib/kernel/cmdline ]; then
53118d
     BOOT_OPTIONS="$(tr -s "$IFS" ' ' 
53118d
-else
53118d
+elif ! systemd-detect-virt --container --quiet; then
53118d
     BOOT_OPTIONS="$(tr -s "$IFS" '\n' 
53118d
+else
53118d
+    BOOT_OPTIONS=""
53118d
 fi
53118d
 
53118d
 BOOT_OPTIONS="${BOOT_OPTIONS% }"
53118d
@@ -194,7 +196,7 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
53118d
         echo "machine-id $MACHINE_ID"
53118d
     fi
53118d
     [ -n "$SORT_KEY" ] && echo "sort-key   $SORT_KEY"
53118d
-    echo "options    $BOOT_OPTIONS"
53118d
+    [ -n "$BOOT_OPTIONS" ] && echo "options    $BOOT_OPTIONS"
53118d
     echo "linux      $KERNEL_ENTRY"
53118d
     [ -n "$DEVICETREE_ENTRY" ] && echo "devicetree $DEVICETREE_ENTRY"
53118d