diff --git a/Add-disable-sbin-override-for-when-sbin-is-a-symlink.patch b/Add-disable-sbin-override-for-when-sbin-is-a-symlink.patch new file mode 100644 index 0000000..df4686c --- /dev/null +++ b/Add-disable-sbin-override-for-when-sbin-is-a-symlink.patch @@ -0,0 +1,88 @@ +From 49822c2130a2a6e1d5a9e414f5a0726a461d9b00 Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Mon, 25 Oct 2021 12:08:46 -0400 +Subject: [PATCH] Add --disable-sbin-override for when /sbin is a symlink + +mount.nfs* umount.nfs* and nfsdcltrack are currently always installed in +/sbin. + +Many distros are moving to a "merged /usr" where /sbin and others are +symlinks into /usr/sbin or similar. In these cases it is inelegant to +install in /sbin (i.e. install through a symlink). + +So we add "--disable-sbin-override" as a configure option. This causes +the same sbindir to be used for *mount.nfs* and nfsdcltrack as for other +system binaries. + +Note that autotools notices if we simply define "sbindir=/sbin" +inside an "if CONFIG_foo" clause, gives a warning, and defeats our +intent. + +So instead, we use the @CONFIG_SBIN_OVERRIDE_TRUE@ prefix to find +the new declaration when we don't want it. + +Signed-off-by: NeilBrown +Signed-off-by: Steve Dickson +--- + configure.ac | 6 ++++++ + utils/mount/Makefile.am | 8 +++++--- + utils/nfsdcltrack/Makefile.am | 9 ++++++--- + 3 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index bc2d0f02979c..93626d62be40 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -187,6 +187,12 @@ else + enable_libmount=no + fi + ++AC_ARG_ENABLE(sbin-override, ++ [AC_HELP_STRING([--disable-sbin-override], ++ [Don't force nfsdcltrack and mount helpers into /sbin: always honour --sbindir])], ++ enable_sbin_override=$enableval, ++ enable_sbin_override=yes) ++ AM_CONDITIONAL(CONFIG_SBIN_OVERRIDE, [test "$enable_sbin_override" = "yes"]) + AC_ARG_ENABLE(junction, + [AC_HELP_STRING([--enable-junction], + [enable support for NFS junctions @<:@default=no@:>@])], +diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am +index ad0be93b1def..3101f7abd7f4 100644 +--- a/utils/mount/Makefile.am ++++ b/utils/mount/Makefile.am +@@ -1,8 +1,10 @@ + ## Process this file with automake to produce Makefile.in + +-# These binaries go in /sbin (not /usr/sbin), and that cannot be +-# overridden at config time. +-sbindir = /sbin ++# These binaries go in /sbin (not /usr/sbin), unless CONFIG_SBIN_OVERRIDE ++# is disabled as may be appropriate when /sbin is a symlink. ++# Note that we don't use "if CONFIG_SBIN_OVERRIDE" as that ++# causes autotools to notice the override and disable it. ++@CONFIG_SBIN_OVERRIDE_TRUE@sbindir = /sbin + + man8_MANS = mount.nfs.man umount.nfs.man + man5_MANS = nfs.man +diff --git a/utils/nfsdcltrack/Makefile.am b/utils/nfsdcltrack/Makefile.am +index 2f7fe3de6922..769e4a455fcf 100644 +--- a/utils/nfsdcltrack/Makefile.am ++++ b/utils/nfsdcltrack/Makefile.am +@@ -1,8 +1,11 @@ + ## Process this file with automake to produce Makefile.in + +-# These binaries go in /sbin (not /usr/sbin), and that cannot be +-# overridden at config time. The kernel "knows" the /sbin name. +-sbindir = /sbin ++# These binaries go in /sbin (not /usr/sbin) as the kernel "knows" the ++# /sbin name. If /sbin is a symlink, CONFIG_SBIN_OVERRIDE can be ++# disabled to install in /usr/sbin anyway. ++# Note that we don't use "if CONFIG_SBIN_OVERRIDE" as that ++# causes autotools to notice the override and disable it. ++@CONFIG_SBIN_OVERRIDE_TRUE@sbindir = /sbin + + man8_MANS = nfsdcltrack.man + EXTRA_DIST = $(man8_MANS) +-- +2.33.1 + diff --git a/nfs-utils.changes b/nfs-utils.changes index 51fea43..a81f122 100644 --- a/nfs-utils.changes +++ b/nfs-utils.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Oct 25 23:53:37 UTC 2021 - Neil Brown + +- add Add-disable-sbin-override-for-when-sbin-is-a-symlink.patch + and use it to move last few binaries from /sbin to /usr/sbin + (bsc#1191082) +- Move nfsdclddb and nfsdclnts from nfs-client to + nfs-kernel-server and fix their permissions. + ------------------------------------------------------------------- Thu Sep 9 23:35:04 UTC 2021 - Neil Brown diff --git a/nfs-utils.spec b/nfs-utils.spec index 2c72546..427641c 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -43,6 +43,7 @@ Source26: nfs.conf Source27: nfs-kernel-server.tmpfiles.conf Patch0: nfs-utils-1.0.7-bind-syntax.patch Patch1: 0001-gssd-fix-crash-in-debug-message.patch +Patch2: Add-disable-sbin-override-for-when-sbin-is-a-symlink.patch BuildRequires: e2fsprogs-devel BuildRequires: gcc-c++ @@ -141,6 +142,7 @@ export LDFLAGS="-pie" --enable-mount \ --enable-libmount-mount \ --disable-static \ + --disable-sbin-override \ --with-pluginpath=%{_libdir}/libnfsidmap-1.0.0 \ --enable-mountconfig make %{?_smp_mflags} @@ -206,7 +208,7 @@ fi ### %{fillup_only -n nfs nfs} # -%set_permissions /sbin/mount.nfs +%set_permissions %{_sbindir}/mount.nfs /sbin/ldconfig %service_add_post auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service @@ -218,7 +220,7 @@ fi %service_del_postun auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service %verifyscript -n nfs-client -%verify_permissions -e /sbin/mount.nfs +%verify_permissions -e %{_sbindir}/mount.nfs %pre -n nfs-kernel-server %service_add_pre nfs-svcgssd.service nfs-mountd.service nfs-server.service @@ -254,14 +256,12 @@ fi %config %{_sysconfdir}/idmapd.conf %config %{_sysconfdir}/nfsmount.conf %config %{_sysconfdir}/nfs.conf -%verify(not mode) %attr(0755,root,root) /sbin/mount.nfs -/sbin/mount.nfs4 -/sbin/umount.nfs -/sbin/umount.nfs4 +%verify(not mode) %attr(0755,root,root) %{_sbindir}/mount.nfs +%{_sbindir}/mount.nfs4 +%{_sbindir}/umount.nfs +%{_sbindir}/umount.nfs4 %attr(0755,root,root) %{_sbindir}/mountstats %attr(0755,root,root) %{_sbindir}/nfsiostat -%{_sbindir}/nfsdclddb -%{_sbindir}/nfsdclnts %{_sbindir}/nfsdcld %{_sbindir}/nfsidmap %{_sbindir}/nfsstat @@ -343,7 +343,9 @@ fi %{_sbindir}/rcnfs-server %{_sbindir}/rpc.mountd %{_sbindir}/rpc.nfsd -/sbin/nfsdcltrack +%{_sbindir}/nfsdcltrack +%attr(0755,root,root) %{_sbindir}/nfsdclddb +%attr(0755,root,root) %{_sbindir}/nfsdclnts %{_mandir}/man5/exports.5%{ext_man} %{_mandir}/man7/nfsd.7%{ext_man} %{_mandir}/man8/exportfs.8%{ext_man}