File nfs-utils.spec of Package nfs-utils.3350

#
# spec file for package nfs-utils
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           nfs-utils
BuildRequires:  device-mapper-devel
BuildRequires:  e2fsprogs-devel
BuildRequires:  gcc-c++
BuildRequires:  krb5-devel
BuildRequires:  libevent-devel
BuildRequires:  libgssglue-devel >= 0.3
BuildRequires:  libmount-devel
BuildRequires:  librpcsecgss
BuildRequires:  libtirpc-devel
BuildRequires:  libtool
BuildRequires:  nfsidmap-devel >= 0.24
BuildRequires:  pkgconfig
BuildRequires:  sqlite3-devel
BuildRequires:  tcpd-devel
%if 0%{?suse_version} >= 1210
BuildRequires:  systemd
%endif
%systemd_requires
Url:            http://kernel.org/pub/linux/utils/nfs-utils/
Summary:        Support Utilities for Kernel nfsd
License:        GPL-2.0+
Group:          Productivity/Networking/NFS
Version:        1.3.0
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %fillup_prereq
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        http://kernel.org/pub/linux/utils/nfs-utils/%{version}/nfs-utils-%{version}.tar.xz
# Download does not work:
# Source1:        ftp://nfs.sourceforge.net/pub/nfs/nfs.doc.tar.bz2
Source1:        nfs.doc.tar.bz2
Source4:        sysconfig.nfs
Source5:        nfs-kernel-server.xml
Source6:        README.NFSv4
Source7:        fw-client
Source8:        fw-server
Source11:       idmapd.conf
Source12:       nfs-config.restart.conf
Source13:       nfs-utils.rpmlintrc
Source14:       nfs-utils_env.sh
Source15:       nfsserver.service
Source16:       nfs.service
Source17:       nfs-server.nfsserver.conf
Source18:       nfs-client.nfs.conf
Patch0:         nfs-utils-1.0.7-bind-syntax.patch
# PATCH-FIX-UPSTREAM nfsdcltrack_sbin.patch nfbrown@suse.de
Patch1:         nfsdcltrack_sbin.patch
Patch2:         start-statd.patch
Patch3:         0001-blkmapd-dump-useful-device-information-to-syslog.patch
Patch4:         0001-blkmapd-fix-broken-multipath-handling.patch
Patch101:       0001-systemd-manually-insert-auth_rpcgss-module.patch
Patch102:       0002-nfs-service-Added-gssproxy-support.patch
Patch103:       0003-nfs-client.target-Removed-a-ordering-cycle-with-nfs-.patch
Patch104:       0004-Centralize-dependencies-on-the-auth-unit.patch
Patch105:       0005-Include-systemd-unit-files-in-dist-and-install.patch
Patch106:       0006-systemd-added-the-BLKMAPDARGS-var-to-the-nfs-blkmap-.patch
Patch107:       0007-systemd-Bind-rpc.idmapd-to-the-nfs-server-service.patch
Patch108:       0008-systemd-Bind-the-nfs-mountd-service-to-the-nfs-serve.patch
Patch109:       0009-sm-notify-Notify-hosts-in-background.patch
Patch110:       0010-systemd-Ensure-RPC-pipefs-is-mounted-before-rpc.idma.patch
Patch111:       0011-rpc-statd-notify-Don-t-wait-for-the-network-to-come-.patch
Patch112:       0012-systemd-Have-rpc-statd-notify.service-Require-networ.patch
Patch113:       0013-systemd-Order-NFS-server-before-client.patch
Patch114:       0014-systemd-Relax-dependencies-of-services.patch
Patch115:       0015-units-nuke-nfs-blkmap.target.patch
Patch116:       0016-nfs-blkmap.service-add-EnvironmentFile-directive.patch
Patch117:       0017-configure.ac-Fix-systemd-autotools-activation-option.patch
Patch118:       0018-gssd-ensure-that-preferred_realm-is-non-NULL-before-.patch
Patch119:       0019-mountd-fix-segfault-in-add_name-with-newer-gcc-compi.patch
Patch120:       0020-mount-improve-error-message-when-statd-cannot-be-sta.patch
Patch121:       0001-mountd-fix-next_mnt-handling-for.patch
Patch130:       0001-mount.nfs-hide-EBUSY-errors.patch
Patch131:       0001-mount.nfs-trust-the-exit-status-of-start_statd.patch
Patch143:       0003-mountd-Don-t-export-unmounted-exports-to-NFSv4.patch
Patch145:       0005-mount-don-t-treat-temporary-name-resolution-failure-.patch
Patch146:       0006-mount-use-a-public-address-for-IPv6-callback.patch
Patch147:       0001-mountd-fix-mount-issue-due-to-comparison-with-uninit.patch
Patch148:       0001-Move-export_d_read-to-support-export-export.c.patch
Patch149:       0002-systemd-improve-ordering-between-nfs-server-and-vari.patch
Patch150:       0001-nfs-server-Use-rpcbind.service-instead-of-rpbind.tar.patch
Patch151:       0002-systemd-Decouple-the-starting-and-stopping-of-rpcbin.patch
Patch152:       0003-systemd-ensure-nfs-config-service-is-re-run-as-neede.patch
Patch153:       0004-systemd-unit-files-fix-up-dependencies-on-rpcbind.patch
Patch161:       0001-nfs-server-generator-avoid-using-external-services.patch
Patch162:       0002-exportfs-avoid-hostname-lookup-when-new_cache-in-use.patch
Patch163:       0003-mountd-delay-reading-etab-until-first-request-arrive.patch
Suggests:       python-base

%description
This package contains the NFS utilities. You can tune the number of
server threads via the sysconfig variable USE_KERNEL_NFSD_NUMBER. For
quota over NFS support, install the quota package.

%define client_services nfs.service nfs-utils.service nfs-client.target rpc-svcgssd.service auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service nfs-config.service
%define server_services nfsserver.service nfs-mountd.service nfs-server.service

%package -n nfs-client
Summary:        Support Utilities for NFS
Group:          Productivity/Networking/NFS
Obsoletes:      nfs-utils < 1.1.0
Requires:       keyutils
Requires:       netcfg
Requires:       rpcbind
PreReq:         %fillup_prereq
PreReq:         permissions

%description -n nfs-client
This package contains common NFS utilities which are needed for client
and kernel based server.

%package -n nfs-kernel-server
Summary:        Support Utilities for Kernel nfsd
Group:          Productivity/Networking/NFS
Provides:       nfs-utils = %{version}
Obsoletes:      nfs-utils < 1.1.0
Conflicts:      nfs-server
Requires:       netcfg
Requires:       nfs-client = %{version}
Requires:       rpcbind
PreReq:         %fillup_prereq
PreReq:         permissions

%description -n nfs-kernel-server
This package contains support for the kernel based NFS server. You can
tune the number of server threads via the sysconfig variable
USE_KERNEL_NFSD_NUMBER. For quota over NFS support, install the quota
package.

%package -n nfs-doc
Summary:        Support Utilities for NFS
Group:          Productivity/Networking/NFS
Obsoletes:      nfs-utils < 1.1.0
Requires:       latex2html-pngicons

%description -n nfs-doc
This package contains additional NFS documentation.

%prep
%setup -q -n nfs-utils-%{version} -a 1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch120 -p1
%patch121 -p1
%patch130 -p1
%patch131 -p1
%patch143 -p1
%patch145 -p1
%patch146 -p1
%patch147 -p1
%patch148 -p1
%patch149 -p1
%patch150 -p1
%patch151 -p1
%patch152 -p1
%patch153 -p1
%patch161 -p1
%patch162 -p1
%patch163 -p1
cp %{S:6} .

%build
rm -f configure; autoreconf -fi
CFLAGS="$RPM_OPT_FLAGS -fPIE -fno-strict-aliasing" LDFLAGS="-pie" ./configure \
	--mandir=%{_mandir} \
	--with-systemd=%{_unitdir} \
	--enable-nfsv4 \
	--enable-gss \
	--enable-ipv6 \
	--enable-nfsdcltrack \
	--enable-mount \
	--enable-libmount-mount \
	--enable-mountconfig
make
cd nfs
for i in *.html ; do
sed -i \
 -e "s@/usr/lib/latex2html/icons.png/next_motif.png@/usr/share/latex2html/icons/next.png@" \
 -e "s@/usr/lib/latex2html/icons.png/up_motif_gr.png@/usr/share/latex2html/icons/up.png@" \
 -e "s@/usr/lib/latex2html/icons.png/previous_motif_gr.png@/usr/share/latex2html/icons/prev.png@" \
 $i
done

%install
make install DESTDIR=$RPM_BUILD_ROOT
# sysconfig-data
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/var/adm/fillup-templates
# idmapd setup
install -d $RPM_BUILD_ROOT/etc
install -m 644 %{S:11} $RPM_BUILD_ROOT/etc/idmapd.conf
mkdir -p -m 755 $RPM_BUILD_ROOT/var/lib/nfs/rpc_pipefs
mkdir -p -m 755 $RPM_BUILD_ROOT/var/lib/nfs/v4recovery
mkdir -p -m 755 $RPM_BUILD_ROOT/usr/share/omc/svcinfo.d
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/usr/share/omc/svcinfo.d
# sm-notify state
mkdir -p -m 755 $RPM_BUILD_ROOT/var/lib/nfs/sm
mkdir -p -m 755 $RPM_BUILD_ROOT/var/lib/nfs/sm.bak
touch $RPM_BUILD_ROOT/var/lib/nfs/state
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services
install -m 0644 %{SOURCE7} ${RPM_BUILD_ROOT}/etc/sysconfig/SuSEfirewall2.d/services/nfs-client
install -m 0644 %{SOURCE8} ${RPM_BUILD_ROOT}/etc/sysconfig/SuSEfirewall2.d/services/nfs-kernel-server
install -m 644 utils/mount/nfsmount.conf $RPM_BUILD_ROOT/etc/nfsmount.conf
#
install -m 644 %{S:15} $RPM_BUILD_ROOT%{_unitdir}/nfsserver.service
install -m 644 %{S:16} $RPM_BUILD_ROOT%{_unitdir}/nfs.service
install -d $RPM_BUILD_ROOT%{_unitdir}/nfs-server.service.d
install -m 644 %{S:17} $RPM_BUILD_ROOT%{_unitdir}/nfs-server.service.d/nfsserver.conf
install -d $RPM_BUILD_ROOT%{_unitdir}/nfs-client.target.d
install -m 644 %{S:18} $RPM_BUILD_ROOT%{_unitdir}/nfs-client.target.d/nfs.conf
install -d $RPM_BUILD_ROOT/usr/lib/systemd/scripts
install -m 755 %{S:14} $RPM_BUILD_ROOT/usr/lib/systemd/scripts/nfs-utils_env.sh
install -d $RPM_BUILD_ROOT%{_unitdir}/nfs-config.service.d
install -m 644 %{S:12} $RPM_BUILD_ROOT%{_unitdir}/nfs-config.service.d/restart.conf
ln -sf /usr/sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfsserver
ln -sf /usr/sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfs-server
ln -sf /usr/sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfs
ln -sf /usr/sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfs-client
# hack to avoid automatic python dependency
chmod 644 $RPM_BUILD_ROOT%{_sbindir}/{mountstats,nfsiostat}

%clean
rm -rf $RPM_BUILD_ROOT

%pre -n nfs-client
useradd -r -c 'NFS statd daemon' \
    -s /sbin/nologin -d /var/lib/nfs -g nogroup statd &> /dev/null || :
%service_add_pre %{client_services}

%post -n nfs-client
chown statd:nogroup /var/lib/nfs
chown -R statd /var/lib/nfs/{state,sm,sm.bak} >& /dev/null || :
### migrate from /var/lock/subsys
[ -d /run/nfs ] || mkdir /run/nfs
if [ -f /var/lock/subsys/nfs-rpc.idmapd ]; then
	mv /var/lock/subsys/nfs-rpc.idmapd /run/nfs
fi
if [ -f /var/lock/subsys/nfsserver-rpc.idmapd ]; then
	mv /var/lock/subsys/nfsserver-rpc.idmapd /run/nfs
fi
###
%{fillup_only -n nfs nfs}
#
%set_permissions /sbin/mount.nfs
%service_add_post %{client_services}

%preun -n nfs-client
%stop_on_removal nfs
%service_del_preun %{client_services}

%postun -n nfs-client
%restart_on_update nfs
%service_del_postun %{client_services}

%verifyscript -n nfs-client
%verify_permissions -e /sbin/mount.nfs

%pre -n nfs-kernel-server
%service_add_pre %{server_services}

%preun -n nfs-kernel-server
%stop_on_removal nfsserver
%service_del_preun %{server_services}

%post -n nfs-kernel-server
### migrate from /var/lock/subsys
[ -d /run/nfs ] || mkdir /run/nfs
if [ -f /var/lock/subsys/nfs-rpc.idmapd ]; then
	mv /var/lock/subsys/nfs-rpc.idmapd /run/nfs
fi
if [ -f /var/lock/subsys/nfsserver-rpc.idmapd ]; then
	mv /var/lock/subsys/nfsserver-rpc.idmapd /run/nfs
fi
###
%fillup_only nfsserver
%service_add_post %{server_services}
%set_permissions /var/lib/nfs/rmtab

%postun -n nfs-kernel-server
%restart_on_update nfsserver
%service_del_postun %{server_services}

%verifyscript -n nfs-kernel-server
%verify_permissions -e /var/lib/nfs/rmtab

%files -n nfs-client
%defattr(-,root,root)
%config /etc/idmapd.conf
%config /etc/nfsmount.conf
%verify(not mode) %attr(0755,root,root) /sbin/mount.nfs
/sbin/mount.nfs4
/sbin/umount.nfs
/sbin/umount.nfs4
/sbin/osd_login
%attr(0755,root,root) /usr/sbin/mountstats
%attr(0755,root,root) /usr/sbin/nfsiostat
/usr/sbin/nfsidmap
/usr/sbin/nfsstat
/usr/sbin/rcnfs
/usr/sbin/rcnfs-client
/usr/sbin/rpc.gssd
/usr/sbin/rpc.idmapd
/usr/sbin/rpc.statd
/usr/sbin/rpcdebug
/usr/sbin/showmount
/usr/sbin/sm-notify
/usr/sbin/start-statd
/usr/sbin/blkmapd
%{_unitdir}/auth-rpcgss-module.service
%{_unitdir}/nfs-blkmap.service
%{_unitdir}/nfs-client.target
%{_unitdir}/nfs-config.service
%{_unitdir}/nfs-idmapd.service
%{_unitdir}/nfs-utils.service
%{_unitdir}/rpc-gssd.service
%{_unitdir}/rpc-statd-notify.service
%{_unitdir}/rpc-statd.service
%{_unitdir}/rpc-svcgssd.service
%{_unitdir}/var-lib-nfs-rpc_pipefs.mount
%{_unitdir}/nfs.service
%dir %{_unitdir}/nfs-client.target.d
%{_unitdir}/nfs-client.target.d/nfs.conf
%dir %{_unitdir}/nfs-config.service.d
%{_unitdir}/nfs-config.service.d/restart.conf
%dir /usr/lib/systemd/scripts
/usr/lib/systemd/scripts/nfs-utils_env.sh
%{_mandir}/man5/nfsmount.conf.5.gz
%{_mandir}/man5/nfs.5.gz
%{_mandir}/man8/mount.nfs.8.gz
%{_mandir}/man8/nfsidmap.8.gz
%{_mandir}/man8/nfsstat.8.gz
%{_mandir}/man8/rpc.sm-notify.8.gz
%{_mandir}/man8/showmount.8.gz
%{_mandir}/man8/sm-notify.8.gz
%{_mandir}/man8/umount.nfs.8.gz
%{_mandir}/man8/rpc.gssd.8.gz
%{_mandir}/man8/rpc.idmapd.8.gz
%{_mandir}/man8/gssd.8.gz
%{_mandir}/man8/idmapd.8.gz
%{_mandir}/man8/svcgssd.8.gz
%{_mandir}/man8/rpc.statd.8.gz
%{_mandir}/man8/rpcdebug.8.gz
%{_mandir}/man8/statd.8.gz
%{_mandir}/man8/mountstats.8.gz
%{_mandir}/man8/nfsiostat.8.gz
%{_mandir}/man8/blkmapd.8.gz
/var/adm/fillup-templates/sysconfig.nfs
%attr(0711,statd,nogroup) %dir /var/lib/nfs
%dir /var/lib/nfs/rpc_pipefs
%dir /var/lib/nfs/v4recovery
%attr(0700,statd,nogroup) %dir /var/lib/nfs/sm
%attr(0700,statd,nogroup) %dir /var/lib/nfs/sm.bak
%attr(0700,statd,nogroup) %ghost /var/lib/nfs/state
%config %attr(0644,root,root) /etc/sysconfig/SuSEfirewall2.d/services/nfs-client

%files -n nfs-kernel-server
%defattr(-,root,root)
%{_unitdir}/nfs-mountd.service
%{_unitdir}/nfs-server.service
%{_unitdir}/proc-fs-nfsd.mount
%{_unitdir}/nfsserver.service
%dir %{_unitdir}/nfs-server.service.d
%{_unitdir}/nfs-server.service.d/nfsserver.conf
/usr/sbin/exportfs
/usr/sbin/rcnfsserver
/usr/sbin/rcnfs-server
/usr/sbin/rpc.mountd
/usr/sbin/rpc.nfsd
/usr/sbin/rpc.svcgssd
/sbin/nfsdcltrack
%dir %{_unitdir}-generators
%{_unitdir}-generators/nfs-server-generator
%{_mandir}/man5/exports.5.gz
%{_mandir}/man7/nfsd.7.gz
%{_mandir}/man8/exportfs.8.gz
%{_mandir}/man8/mountd.8.gz
%{_mandir}/man8/nfsd.8.gz
%{_mandir}/man8/rpc.mountd.8.gz
%{_mandir}/man8/rpc.nfsd.8.gz
%{_mandir}/man8/rpc.svcgssd.8.gz
%{_mandir}/man8/nfsdcltrack.8.gz
/usr/share/omc/svcinfo.d/nfs-kernel-server.xml
%config(noreplace) /var/lib/nfs/xtab
%config(noreplace) /var/lib/nfs/etab
%config(noreplace) /var/lib/nfs/rmtab
%config %attr(0644,root,root) /etc/sysconfig/SuSEfirewall2.d/services/nfs-kernel-server

%files -n nfs-doc
%defattr(-,root,root)
%doc nfs/*.html nfs/*.ps README.NFSv4

%changelog