From 41b38ab6e7a411e609776eec544451f3de76e523 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com>
Date: Mon, 10 Dec 2018 17:49:54 +0100
Subject: [PATCH] Added workaround for zipl (s390x) not supporting multiple
initrds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This workaround can be removed once implemented upstream, ticket:
https://github.com/ibm-s390-tools/s390-tools/issues/49
RHEL bugzilla:
rhbz#1576435
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
---
91-tuned.install => 92-tuned.install | 15 ++++++++++++---
Makefile | 4 ++--
tuned.spec | 2 +-
tuned/consts.py | 2 +-
4 files changed, 16 insertions(+), 7 deletions(-)
rename 91-tuned.install => 92-tuned.install (58%)
diff --git a/91-tuned.install b/92-tuned.install
similarity index 58%
rename from 91-tuned.install
rename to 92-tuned.install
index 18d00d9..00eefc7 100644
--- a/91-tuned.install
+++ b/92-tuned.install
@@ -19,13 +19,22 @@ LOADER_ENTRIES="$BOOT_ROOT/loader/entries"
[ "$COMMAND" = "add" ] || exit 0
-pushd "$LOADER_ENTRIES"
+# Workaround for rhbz#1657858
+ARCH=`uname -m`
+[ "${ARCH:0:4}" = "s390" ]
+HANDLE_INITRD="$?"
+
+pushd "$LOADER_ENTRIES" &> /dev/null
for f in `basename "$MACHINE_ID"`-*.conf; do
if [ -f "$f" -a "${f: -12}" != "-rescue.conf" ]; then
grep -q '^\s*options\s\+.*\$tuned_params' "$f" || sed -i '/^\s*options\s\+/ s/\(.*\)/\1 \$tuned_params/' "$f"
- grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f"
+ if [ "$HANDLE_INITRD" = "1" ]; then
+ grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f"
+ else
+ sed -i '/^\s*initrd\s\+.*\$tuned_initrd/ s/\s\+\$tuned_initrd\b//g' "$f"
+ fi
fi
done
-popd
+popd &> /dev/null
exit 0
diff --git a/Makefile b/Makefile
index f61cd01..36e22ff 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ release-cp: release-dir
cp -a tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \
tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned \
- 91-tuned.install bootcmdline modules.conf com.redhat.tuned.policy \
+ 92-tuned.install bootcmdline modules.conf com.redhat.tuned.policy \
com.redhat.tuned.gui.policy tuned-gui.py tuned-gui.glade \
tuned-gui.desktop $(VERSIONED_NAME)
cp -a doc experiments libexec man profiles systemtap tuned contrib icons \
@@ -182,7 +182,7 @@ install: install-dirs
install -Dpm 0755 00_tuned $(DESTDIR)$(SYSCONFDIR)/grub.d/00_tuned
# kernel install hook
- install -Dpm 0755 91-tuned.install $(DESTDIR)$(KERNELINSTALLHOOKDIR)/91-tuned.install
+ install -Dpm 0755 92-tuned.install $(DESTDIR)$(KERNELINSTALLHOOKDIR)/92-tuned.install
# polkit configuration
install -Dpm 0644 com.redhat.tuned.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/com.redhat.tuned.policy
diff --git a/tuned.spec b/tuned.spec
index 300c8aa..6ac575e 100644
--- a/tuned.spec
+++ b/tuned.spec
@@ -392,7 +392,7 @@ fi
%{_datadir}/tuned/grub2
%{_datadir}/polkit-1/actions/com.redhat.tuned.policy
%ghost %{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf
-%{_prefix}/lib/kernel/install.d/91-tuned.install
+%{_prefix}/lib/kernel/install.d/92-tuned.install
%files gtk
%defattr(-,root,root,-)
diff --git a/tuned/consts.py b/tuned/consts.py
index de94059..39f9209 100644
--- a/tuned/consts.py
+++ b/tuned/consts.py
@@ -38,7 +38,7 @@ BOOT_CMDLINE_INITRD_ADD_VAR = "TUNED_BOOT_INITRD_ADD"
BOOT_CMDLINE_FILE = "/etc/tuned/bootcmdline"
PETITBOOT_DETECT_DIR = "/sys/firmware/opal"
MACHINE_ID_FILE = "/etc/machine-id"
-KERNEL_UPDATE_HOOK_FILE = "/usr/lib/kernel/install.d/91-tuned.install"
+KERNEL_UPDATE_HOOK_FILE = "/usr/lib/kernel/install.d/92-tuned.install"
BLS_ENTRIES_PATH = "/boot/loader/entries"
# modules plugin configuration
--
2.17.2