From c20c01185ed748b2bc823369a8f28cf004b7d1c9 Mon Sep 17 00:00:00 2001 From: Stephan Wiesand Date: Wed, 7 May 2014 15:20:51 +0200 Subject: [PATCH] redhat: Use the right path to depmod As of Fedora 17 and RHEL 7, depmod has moved from /sbin to /usr/sbin. The full path to depmod is used in package scripts and as a dependency. This hasn't caused problems in most cases because on an installed system a link /sbin -> /usr/sbin is present and during ordinary package installations yum/rpm correctly then figure out that /sbin/depmod is actually provided. But in other situations, the dependency check is not that clever and (incorrectly) fails. Add a macro to the spec defining the full path to depmod, use the macro rather than plain /sbin/depmod throughout the spec, and also pass it to kmodtool when required to generate the kmod package scripts and requirements. FIXES 131860 Change-Id: I1f2e4f7100d244477c2cb9087d2f48bbcea27fdc Reviewed-on: http://gerrit.openafs.org/11128 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Perry Ruiter Reviewed-by: D Brashear --- src/packaging/RedHat/openafs-kmodtool | 15 +++++++++----- src/packaging/RedHat/openafs.spec.in | 28 ++++++++++++++++----------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/packaging/RedHat/openafs-kmodtool b/src/packaging/RedHat/openafs-kmodtool index b9ae6661b..88d10b2c5 100644 --- a/src/packaging/RedHat/openafs-kmodtool +++ b/src/packaging/RedHat/openafs-kmodtool @@ -100,17 +100,17 @@ Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} Provides: openafs-kernel = %{PACKAGE_VERSION} Requires: ${kdep} Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version} -Requires(post): /sbin/depmod -Requires(postun): /sbin/depmod +Requires(post): ${depmod} +Requires(postun): ${depmod} Release: %{pkgrel}.%(echo ${verrel} | tr - _) BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel} %description -n kmod-${kmod_name}${dashvariant} This package provides the ${kmod_name} kernel modules built for the Linux kernel ${kname} for the %{_target_cpu} family of processors. %post -n kmod-${kmod_name}${dashvariant} -/sbin/depmod -aeF /boot/System.map-${kname} ${kname} > /dev/null || : +${depmod} -aeF /boot/System.map-${kname} ${kname} > /dev/null || : %postun -n kmod-${kmod_name}${dashvariant} -/sbin/depmod -aF /boot/System.map-${kname} ${kname} &> /dev/null || : +${depmod} -aF /boot/System.map-${kname} ${kname} &> /dev/null || : %files -n kmod-${kmod_name}${dashvariant} %defattr(644,root,root,755) /lib/modules/${kname}/extra/${kmod_name}/ @@ -125,12 +125,17 @@ print_rpmtemplate () kver="${1}" get_verrel "${1}" shift + depmod="${1}" + shift if [ -z "${kmod_name}" ] ; then echo "Please provide the kmodule-name as first parameter." >&2 exit 2 elif [ -z "${kver}" ] ; then echo "Please provide the kver as second parameter." >&2 exit 2 + elif [ -z "${depmod}" ] ; then + echo "Please provide the full path to depmod as third parameter." >&2 + exit 2 elif [ -z "${verrel}" ] ; then echo "Couldn't find out the verrel." >&2 exit 2 @@ -152,7 +157,7 @@ Usage: ${myprog}