From 12da227455a6872d695cdcac1093b6b5fe9f9008 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Nov 04 2016 02:11:56 +0000 Subject: Replace grubby patch with a short-circuiting install.d "plugin" --- diff --git a/20-grubby.install b/20-grubby.install new file mode 100755 index 0000000..5d417f9 --- /dev/null +++ b/20-grubby.install @@ -0,0 +1,51 @@ +#!/bin/bash + +if [[ ! -x /sbin/new-kernel-pkg ]]; then + return 0 +fi + +COMMAND="$1" +KERNEL_VERSION="$2" +BOOT_DIR_ABS="$3" +KERNEL_IMAGE="$4" + +KERNEL_DIR="${KERNEL_IMAGE%/*}" +[[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}" +case "$COMMAND" in + add) + if [[ "${KERNEL_DIR}" != "/boot" ]]; then + for i in \ + "$KERNEL_IMAGE" \ + "$KERNEL_DIR"/System.map \ + "$KERNEL_DIR"/config \ + "$KERNEL_DIR"/zImage.stub \ + "$KERNEL_DIR"/dtb \ + ; do + [[ -e "$i" ]] || continue + cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" + command -v restorecon &>/dev/null && \ + restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" + done + # hmac is .vmlinuz-.hmac so needs a special treatment + i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" + if [[ -e "$i" ]]; then + cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" + command -v restorecon &>/dev/null && \ + restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" + fi + fi + /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $? + /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $? + /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $? + ;; + remove) + /sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$KERNEL_VERSION" || exit $? + ;; + *) + ;; +esac + +# skip other installation plugins, if we can't find a boot loader spec conforming setup +if ! [[ -d /boot/loader/entries || -L /boot/loader/entries ]]; then + exit 77 +fi diff --git a/kernel-install-grubby.patch b/kernel-install-grubby.patch deleted file mode 100644 index 8dc346b..0000000 --- a/kernel-install-grubby.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 859a022f807bbab2d072c7299743b527156e7f7d Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Tue, 14 Jan 2014 17:48:08 -0500 -Subject: [PATCH] kernel-install: add fedora specific callouts to - new-kernel-pkg - ---- - src/kernel-install/kernel-install | 43 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 43 insertions(+) - mode change 100644 => 100755 src/kernel-install/kernel-install - -diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install -old mode 100644 -new mode 100755 -index 3ae1d77..2b8fe1e ---- a/src/kernel-install/kernel-install -+++ b/src/kernel-install/kernel-install -@@ -71,6 +71,49 @@ fi - KERNEL_VERSION="$1" - KERNEL_IMAGE="$2" - -+if [[ -x /sbin/new-kernel-pkg ]]; then -+ KERNEL_DIR="${KERNEL_IMAGE%/*}" -+ [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}" -+ case "$COMMAND" in -+ add) -+ if [[ "${KERNEL_DIR}" != "/boot" ]]; then -+ for i in \ -+ "$KERNEL_IMAGE" \ -+ "$KERNEL_DIR"/System.map \ -+ "$KERNEL_DIR"/config \ -+ "$KERNEL_DIR"/zImage.stub \ -+ "$KERNEL_DIR"/dtb \ -+ ; do -+ [[ -e "$i" ]] || continue -+ cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" -+ command -v restorecon &>/dev/null && \ -+ restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" -+ done -+ # hmac is .vmlinuz-.hmac so needs a special treatment -+ i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" -+ if [[ -e "$i" ]]; then -+ cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" -+ command -v restorecon &>/dev/null && \ -+ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" -+ fi -+ fi -+ /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $? -+ /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $? -+ /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $? -+ ;; -+ remove) -+ /sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$KERNEL_VERSION" || exit $? -+ ;; -+ *) -+ ;; -+ esac -+ -+ # exit, if we can't find a boot loader spec conforming setup -+ if ! [[ -d /boot/loader/entries || -L /boot/loader/entries ]]; then -+ exit 0 -+ fi -+fi -+ - if [[ -f /etc/machine-id ]]; then - read MACHINE_ID < /etc/machine-id - fi --- -2.7.2 - diff --git a/systemd.spec b/systemd.spec index 148083f..56b5d2b 100644 --- a/systemd.spec +++ b/systemd.spec @@ -36,12 +36,10 @@ Source7: systemd-journal-remote.xml Source8: systemd-journal-gatewayd.xml Source9: 20-yama-ptrace.conf Source10: systemd-udev-trigger-no-reload.conf +Source11: 20-grubby.install Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch -# kernel-install patch for grubby, drop if grubby is obsolete -Patch1000: kernel-install-grubby.patch - %global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);} BuildRequires: libcap-devel @@ -344,6 +342,8 @@ install -Dm0644 -t %{buildroot}%{_pkgdocdir}/ %{SOURCE9} # https://bugzilla.redhat.com/show_bug.cgi?id=1378974 install -Dm0644 -t %{buildroot}%{system_unit_dir}/systemd-udev-trigger.service.d/ %{SOURCE10} +install -Dm0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE11} + %find_lang %{name} %check @@ -554,7 +554,6 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd %dir %{_prefix}/lib/modules-load.d %dir %{_prefix}/lib/binfmt.d %dir %{_prefix}/lib/kernel -%dir %{_prefix}/lib/kernel/install.d %dir %{_datadir}/systemd %dir %{_datadir}/pkgconfig %dir %{_datadir}/zsh @@ -704,8 +703,7 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd %{_prefix}/lib/sysusers.d/systemd.conf %{pkgdir}/system-preset/90-systemd.preset %{pkgdir}/catalog/systemd.catalog -%{_prefix}/lib/kernel/install.d/50-depmod.install -%{_prefix}/lib/kernel/install.d/90-loaderentry.install +%{_prefix}/lib/kernel/install.d/ %{_sbindir}/init %{_sbindir}/reboot %{_sbindir}/halt @@ -942,6 +940,7 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd - Update to latest version - Add %%{_isa} to Provides on arch-full packages (#1387912) - Create systemd-coredump user in %%pre (#1348891) +- Replace grubby patch with a short-circuiting install.d "plugin" * Tue Oct 18 2016 Jan Synáček - 231-11 - SPC - Cannot restart host operating from container (#1384523)