From 33f6bd10e4d37e56e5cba6b6554fe8ee5f0b3b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Thu, 24 Sep 2015 11:06:32 +0200 Subject: [PATCH] spec: fixed post scriptlet to work without grub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: rhbz#1265654 Signed-off-by: Jaroslav Škarvada --- tuned.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tuned.spec b/tuned.spec index 23d3149..5e2c284 100644 --- a/tuned.spec +++ b/tuned.spec @@ -147,8 +147,10 @@ rmdir %{buildroot}%{_sysconfdir}/grub.d sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile # convert GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT -sed -i 's/GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX \\$tuned_params"/GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \\$tuned_params"/' \ - %{_sysconfdir}/default/grub +if [ -r "%{_sysconfdir}/default/grub" ]; then + sed -i 's/GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX \\$tuned_params"/GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \\$tuned_params"/' \ + %{_sysconfdir}/default/grub +fi %preun @@ -163,7 +165,9 @@ sed -i 's/GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX \\$tuned_params"/GRUB_CMDLINE_ if [ "$1" == 0 ]; then rm -f %{_sysconfdir}/grub.d/00_tuned || : # unpatch /etc/default/grub - sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \\$tuned_params"/d' %{_sysconfdir}/default/grub + if [ -r "%{_sysconfdir}/default/grub" ]; then + sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \\$tuned_params"/d' %{_sysconfdir}/default/grub + fi fi