68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
From b3480d31b01e66e21a70b7dab55eac95449126c7 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Tsoy <alexander@tsoy.me>
|
|
Date: Sat, 8 Sep 2018 17:02:03 +0300
|
|
Subject: [PATCH] Prevent environment leaking into initrd-release
|
|
|
|
On my system the following initrd-release is generated:
|
|
...
|
|
VERSION="4 dracut-048 dracut-048"
|
|
...
|
|
|
|
VERSION is not defined in /etc/os-release, so the variable is
|
|
concatenated with its previous value:
|
|
|
|
* "4" comes from the kernel build system since dracut is called from the
|
|
kernel install hook ("4" is a major kernel version);
|
|
* first "dracut-048" comes from the "systemd-initrd" module;
|
|
* second "dracut-048" comes from the "base" module.
|
|
---
|
|
modules.d/01systemd-initrd/module-setup.sh | 9 ++++-----
|
|
modules.d/99base/module-setup.sh | 9 ++++-----
|
|
2 files changed, 8 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh
|
|
index c1ccd2af..cb8a8fa6 100755
|
|
--- a/modules.d/01systemd-initrd/module-setup.sh
|
|
+++ b/modules.d/01systemd-initrd/module-setup.sh
|
|
@@ -38,13 +38,12 @@ install() {
|
|
|
|
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
|
|
|
+ local VERSION=""
|
|
+ local PRETTY_NAME=""
|
|
if [ -e /etc/os-release ]; then
|
|
. /etc/os-release
|
|
- VERSION+=" "
|
|
- PRETTY_NAME+=" "
|
|
- else
|
|
- VERSION=""
|
|
- PRETTY_NAME=""
|
|
+ [[ -n ${VERSION} ]] && VERSION+=" "
|
|
+ [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
|
fi
|
|
NAME=dracut
|
|
ID=dracut
|
|
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
|
|
index 731c6dcc..21523fc9 100755
|
|
--- a/modules.d/99base/module-setup.sh
|
|
+++ b/modules.d/99base/module-setup.sh
|
|
@@ -63,13 +63,12 @@ install() {
|
|
echo ro >> "${initdir}/etc/cmdline.d/base.conf"
|
|
fi
|
|
|
|
+ local VERSION=""
|
|
+ local PRETTY_NAME=""
|
|
if [ -e /etc/os-release ]; then
|
|
. /etc/os-release
|
|
- VERSION+=" "
|
|
- PRETTY_NAME+=" "
|
|
- else
|
|
- VERSION=""
|
|
- PRETTY_NAME=""
|
|
+ [[ -n ${VERSION} ]] && VERSION+=" "
|
|
+ [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
|
fi
|
|
NAME=dracut
|
|
ID=dracut
|
|
|