Blob Blame History Raw
From 0bb9a683d4df27427a0ab1d247b6dbb8343d820e Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 15 Mar 2018 16:57:47 +0100
Subject: [PATCH] spec: drop support for legacy distributions

rhel <= 7 has its own branch and there is no point in supporting the old
fedora
---
 51-dracut-rescue-postinst.sh | 68 ---------------------------------------
 dracut.spec                  | 75 +++++++-------------------------------------
 2 files changed, 12 insertions(+), 131 deletions(-)

diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh
deleted file mode 100755
index 67f5b717..00000000
--- a/51-dracut-rescue-postinst.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-
-export LANG=C
-
-KERNEL_VERSION="$1"
-KERNEL_IMAGE="$2"
-
-[[ -f /etc/os-release ]] && . /etc/os-release
-
-if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
-    systemd-machine-id-setup
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-[[ $MACHINE_ID ]] || exit 1
-[[ -f $KERNEL_IMAGE ]] || exit 1
-
-INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
-NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
-
-[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
-
-dropindirs_sort()
-{
-    suffix=$1; shift
-    args=("$@")
-    files=$(
-        while (( $# > 0 )); do
-            for i in ${1}/*${suffix}; do
-                [[ -f $i ]] && echo ${i##*/}
-            done
-            shift
-        done | sort -Vu
-    )
-
-    for f in $files; do
-        for d in "${args[@]}"; do
-            if [[ -f "$d/$f" ]]; then
-                echo "$d/$f"
-                continue 2
-            fi
-        done
-    done
-}
-
-# source our config dir
-for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
-    [[ -e $f ]] && . "$f"
-done
-
-[[ $dracut_rescue_image != "yes" ]] && exit 0
-
-if [[ ! -f $INITRDFILE ]]; then
-    dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
-    ((ret+=$?))
-fi
-
-if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
-    cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
-    ((ret+=$?))
-fi
-
-new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
-
-((ret+=$?))
-
-exit $ret
diff --git a/dracut.spec b/dracut.spec
index 725f89d6..9c2fc9d4 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -5,15 +5,6 @@
 # strip the automatically generated dep here and instead co-own the
 # directory.
 %global __requires_exclude pkg-config
-
-# Variables must be defined
-%define with_nbd                1
-
-# nbd in Fedora only
-%if 0%{?rhel} >= 6
-%define with_nbd 0
-%endif
-
 %define dist_free_release xxx
 
 Name: dracut
@@ -46,6 +37,7 @@ BuildRequires: gcc
 
 %if 0%{?fedora} || 0%{?rhel}
 BuildRequires: pkgconfig
+BuildRequires: systemd
 %endif
 %if 0%{?fedora}
 BuildRequires: bash-completion
@@ -63,31 +55,11 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
 BuildRequires: asciidoc
 %endif
 
-%if 0%{?fedora} > 12 || 0%{?rhel}
-# no "provides", because dracut does not offer
-# all functionality of the obsoleted packages
-Obsoletes: mkinitrd < 6.0.94
-Obsoletes: mkinitrd-devel < 6.0.94
-Obsoletes: nash < 6.0.94
-Obsoletes: libbdevid-python < 6.0.94
-%endif
-
-%if 0%{?fedora} > 16 || 0%{?rhel} > 6
-BuildRequires: systemd-units
-%endif
-
 %if 0%{?suse_version} > 9999
 Obsoletes: mkinitrd < 2.6.1
 Provides: mkinitrd = 2.6.1
 %endif
 
-Obsoletes: dracut-kernel < 005
-Provides:  dracut-kernel = %{version}-%{release}
-
-Obsoletes: dracut < 030
-Obsoletes: dracut-norescue < 030
-Provides:  dracut-norescue = %{version}-%{release}
-
 Requires: bash >= 4
 Requires: coreutils
 Requires: cpio
@@ -99,33 +71,23 @@ Requires: sed
 Requires: xz
 Requires: gzip
 
-%if 0%{?fedora} > 22 || 0%{?rhel} > 7
+%if 0%{?fedora} || 0%{?rhel}
 Recommends: grubby
 Recommends: hardlink
 Recommends: pigz
 Recommends: kpartx
-%else
-Requires: hardlink
-Requires: gzip
-Requires: kpartx
-%endif
-
-%if 0%{?fedora} || 0%{?rhel} > 6
 Requires: util-linux >= 2.21
 Requires: systemd >= 219
 Requires: systemd-udev >= 219
 Requires: procps-ng
-Conflicts: grubby < 8.23
-Conflicts: initscripts < 8.63-1
-Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
-Conflicts: bcache-tools < 0-0.14.20130909git
 %else
+Requires: hardlink
+Requires: gzip
+Requires: kpartx
 Requires: udev > 166
 Requires: util-linux-ng >= 2.21
 %endif
 
-Conflicts: mdadm < 3.2.6-14
-
 %description
 dracut contains tools to create bootable initramfses for the Linux
 kernel. Unlike previous implementations, dracut hard-codes as little
@@ -155,17 +117,12 @@ Provides:  dracut-generic = %{version}-%{release}
 This package requires everything which is needed to build a generic
 all purpose initramfs with network support with dracut.
 
-%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
+%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
 %package fips
 Summary: dracut modules to build a dracut initramfs with an integrity check
 Requires: %{name} = %{version}-%{release}
 Requires: hmaccalc
-%if 0%{?rhel} > 5
-# For Alpha 3, we want nss instead of nss-softokn
 Requires: nss
-%else
-Requires: nss-softokn
-%endif
 Requires: nss-softokn-freebl
 
 %description fips
@@ -250,9 +207,6 @@ cp %{SOURCE1} .
 make %{?_smp_mflags}
 
 %install
-%if 0%{?fedora} || 0%{?rhel}
-rm -rf -- $RPM_BUILD_ROOT
-%endif
 make %{?_smp_mflags} install \
      DESTDIR=$RPM_BUILD_ROOT \
      libdir=%{_prefix}/lib
@@ -314,16 +268,12 @@ install -m 0644 dracut.conf.d/suse.conf.example   $RPM_BUILD_ROOT%{dracutlibdir}
 install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
 %endif
 
-%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
+%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
 rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
 rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
 %endif
 
-%if 0%{?fedora} || 0%{?rhel} > 6
-# FIXME: remove after F19
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
-install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
-
+%if 0%{?fedora} || 0%{?rhel}
 echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
 echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
 %endif
@@ -342,7 +292,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
 %{_bindir}/dracut
 %{_datadir}/bash-completion/completions/dracut
 %{_datadir}/bash-completion/completions/lsinitrd
-%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
+%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
 %{_bindir}/mkinitrd
 %{_bindir}/lsinitrd
 %endif
@@ -368,7 +318,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
 %if %{with doc}
 %{_mandir}/man8/dracut.8*
 %{_mandir}/man8/*service.8*
-%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
+%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
 %{_mandir}/man8/mkinitrd.8*
 %{_mandir}/man1/lsinitrd.1*
 %endif
@@ -462,7 +412,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
 %{_unitdir}/initrd.target.wants/dracut-pre-udev.service
 
 %endif
-%if 0%{?fedora} || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel}
 %{_prefix}/lib/kernel/install.d/50-dracut.install
 %endif
 
@@ -527,9 +477,8 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
 %files config-rescue
 %defattr(-,root,root,0755)
 %{dracutlibdir}/dracut.conf.d/02-rescue.conf
-%if 0%{?fedora} || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel}
 %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
-%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
 %endif
 
 %changelog