Browse code

Adding rpcbind package and systemd services for nfs-client

Change-Id: I9d3dfd22d615fd69eda7ef51b0949654cb02d698
Reviewed-on: http://photon-jenkins.eng.vmware.com/237
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: Sharath George

dthaluru authored on 2015/12/09 09:11:57
Showing 11 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+[Unit]
1
+Description=NFS server and client services
2
+
3
+[Service]
4
+Type=oneshot
5
+RemainAfterExit=yes
6
+ExecStart=/bin/true
0 7
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+[Unit]
1
+Description=NFS client services
2
+Before=remote-fs-pre.target
3
+Wants=remote-fs-pre.target rpc-statd-notify.service
4
+
5
+[Install]
6
+WantedBy=multi-user.target
7
+WantedBy=remote-fs.target
0 8
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+# Begin /etc/default/nfs-utils
1
+
2
+# Options to pass to rpc.idmapd.
3
+# See rpc.idmapd(8) for more details.
4
+IDMAPD_OPTS=""
5
+
6
+# Options to paass to rpc.mountd.
7
+# If you have a port-based firewall, you might want to set up
8
+# a fixed port here using the --port option.
9
+# See rpc.mountd(8) for more details.
10
+MOUNTD_OPTS=""
11
+
12
+# Options to pass to rpc.nfsd.
13
+# See rpc.nfsd(8) for more details.
14
+NFSD_OPTS=""
15
+
16
+# Options to pass to sm-notify.
17
+# See sm-notify(8) for more details.
18
+SM_NOTIFY_OPTS=""
19
+
20
+# Options to pass to rpc.statd.
21
+# See rpc.statd(8) for more details.
22
+STATD_OPTS=""
23
+
24
+# End /etc/default/nfs-utils
... ...
@@ -1,18 +1,24 @@
1 1
 Summary:	NFS client utils
2 2
 Name:		nfs-utils
3 3
 Version:	1.3.2
4
-Release:	1%{?dist}
5
-License:	GPLv3+
6
-URL:		http://www.linuxfromscratch.org/
4
+Release:	2%{?dist}
5
+License:	GPLv2+
6
+URL:		http://sourceforge.net/projects/nfs
7 7
 Group:		Applications/Nfs-utils-client
8
-Source0:	 http://downloads.sourceforge.net/nfs/%{name}-%{version}.tar.bz2
8
+Source0:    http://downloads.sourceforge.net/nfs/%{name}-%{version}.tar.bz2
9 9
 %define sha1 nfs-utils=138ad690992d4784c05024d814a2d49ee8ebf6be
10
+Source1:    nfs-client.service
11
+Source2:    nfs-client.target
12
+Source3:    rpc-statd.service
13
+Source4:    rpc-statd-notify.service
14
+Source5:    nfs-utils.defaults
10 15
 Vendor:		VMware, Inc.
11 16
 Distribution:	Photon
12
-BuildRequires: krb5
13
-BuildRequires: libtirpc-devel
14
-Requires: python2-libs
15
-Requires: libtirpc
17
+BuildRequires:  krb5
18
+BuildRequires:  libtirpc-devel
19
+Requires:   python2-libs
20
+Requires:   libtirpc
21
+Requires:   rpcbind
16 22
 
17 23
 %description
18 24
 The nfs-utils package contains simple nfs client service
... ...
@@ -24,12 +30,23 @@ sed -i "/daemon_init/s:\!::" utils/statd/statd.c
24 24
 %build
25 25
 ./configure --prefix=%{_prefix}          \
26 26
             --sysconfdir=%{_sysconfdir}      \
27
+            --enable-libmount-mount \
27 28
             --without-tcp-wrappers \
28 29
             --disable-nfsv4        \
29 30
             --disable-gss
30 31
 make
31 32
 %install
32 33
 make DESTDIR=%{buildroot} install
34
+install -v -m644 utils/mount/nfsmount.conf /etc/nfsmount.conf
35
+
36
+mkdir -p %{buildroot}/lib/systemd/system/
37
+mkdir -p %{buildroot}/etc/default
38
+install -m644 %{SOURCE1} %{buildroot}/lib/systemd/system/
39
+install -m644 %{SOURCE2} %{buildroot}/lib/systemd/system/
40
+install -m644 %{SOURCE3} %{buildroot}/lib/systemd/system/
41
+install -m644 %{SOURCE4} %{buildroot}/lib/systemd/system/
42
+install -m644 %{SOURCE5} %{buildroot}/etc/default/nfs-utils
43
+
33 44
 %files
34 45
 %defattr(-,root,root)
35 46
 %{_libdir}/*
... ...
@@ -37,6 +54,11 @@ make DESTDIR=%{buildroot} install
37 37
 /sbin/*
38 38
 %{_sbindir}/*
39 39
 %{_sharedstatedir}/*
40
+/etc/default/nfs-utils
41
+/lib/systemd/system/*
42
+
40 43
 %changelog
44
+*	Tue Dec 8 2015 Divya Thaluru <dthaluru@vmware.com> 1.3.2-2
45
+-	Adding systemd service files
41 46
 *	Tue Jul 14 2015 Rongrong Qiu <rqiu@vmware.com> 1.3.2-1
42 47
 -	Initial build.	First version
43 48
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+[Unit]
1
+Description=Notify NFS peers of a restart
2
+Requires=network-online.target
3
+After=network-online.target nss-lookup.target nfs-server.service
4
+PartOf=nfs-client.service
5
+
6
+[Service]
7
+Type=forking
8
+EnvironmentFile=/etc/default/nfs-utils
9
+ExecStart=/sbin/sm-notify $SM_NOTIFY_OPTS
0 10
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+[Unit]
1
+Description=NFS status monitor for NFSv2/3 locking.
2
+DefaultDependencies=no
3
+Conflicts=umount.target
4
+Requires=nss-lookup.target rpcbind.target
5
+After=network.target nss-lookup.target rpcbind.target
6
+PartOf=nfs-client.service
7
+
8
+[Service]
9
+Type=forking
10
+EnvironmentFile=/etc/default/nfs-utils
11
+PIDFile=/var/run/rpc.statd.pid
12
+ExecStart=/sbin/rpc.statd --no-notify $STATD_OPTS
0 13
new file mode 100644
... ...
@@ -0,0 +1,48 @@
0
+Submitted By:            Bruce Dubbs <bdubbs_at_linuxfromscratch_dot_org>
1
+Date:                    2015-11-29
2
+Initial Package Version: 0.2.3
3
+Upstream Status:         Already in upstream git repository
4
+Origin:                  Upstream
5
+Description:             This patch fixes rpcbind to be able to build with 
6
+                         recent tirpc versions.
7
+
8
+From 9194122389f2a56b1cd1f935e64307e2e963c2da Mon Sep 17 00:00:00 2001
9
+From: Steve Dickson <steved@redhat.com>
10
+Date: Mon, 2 Nov 2015 17:05:18 -0500
11
+Subject: [PATCH] handle_reply: Don't use the xp_auth pointer directly
12
+
13
+In the latest libtirpc version to access the xp_auth
14
+one must use the SVC_XP_AUTH macro. To be backwards
15
+compatible a couple ifdefs were added to use the
16
+macro when it exists.
17
+
18
+Signed-off-by: Steve Dickson <steved@redhat.com>
19
+---
20
+ src/rpcb_svc_com.c | 7 +++++++
21
+ 1 file changed, 7 insertions(+)
22
+
23
+diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
24
+index 4ae93f1..22d6c84 100644
25
+--- a/src/rpcb_svc_com.c
26
+@@ -1295,10 +1295,17 @@ handle_reply(int fd, SVCXPRT *xprt)
27
+ 	a.rmt_localvers = fi->versnum;
28
+ 
29
+ 	xprt_set_caller(xprt, fi);
30
++#if defined(SVC_XP_AUTH)
31
++	SVC_XP_AUTH(xprt) = svc_auth_none;
32
++#else 
33
+ 	xprt->xp_auth = &svc_auth_none;
34
++#endif
35
+ 	svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a);
36
++#if !defined(SVC_XP_AUTH)
37
+ 	SVCAUTH_DESTROY(xprt->xp_auth);
38
+ 	xprt->xp_auth = NULL;
39
++#endif
40
++
41
+ done:
42
+ 	if (buffer)
43
+ 		free(buffer);
44
+-- 
45
+1.8.2.1
46
+
0 47
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+[Unit]
1
+Description=RPC Bind Service
2
+Requires=rpcbind.socket
3
+
4
+[Service]
5
+Type=forking
6
+EnvironmentFile=-/etc/sysconfig/rpcbind
7
+ExecStart=/usr/sbin/rpcbind $RPCBIND_OPTIONS -w
8
+
9
+[Install]
10
+WantedBy=multi-user.target
11
+Also=rpcbind.socket
0 12
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+[Unit]
1
+Description=RPCbind Server Activation Socket
2
+
3
+[Socket]
4
+ListenStream=/var/run/rpcbind.sock
5
+
6
+[Install]
7
+WantedBy=sockets.target
0 8
new file mode 100644
... ...
@@ -0,0 +1,80 @@
0
+Summary:	RPC program number mapper
1
+Name:		rpcbind
2
+Version:	0.2.3
3
+Release:	1%{?dist}
4
+License:	BSD
5
+URL:		http://nfsv4.bullopensource.org
6
+Group:	    Applications/Daemons
7
+Source0:    http://downloads.sourceforge.net/rpcbind/%{name}-%{version}.tar.bz2
8
+%define sha1 rpcbind=e79974a99d09b6d6fff9d86bf00225dc33723ce2
9
+Source1:    rpcbind.service
10
+Source2:    rpcbind.socket
11
+Source3:    rpcbind.sysconfig
12
+Patch0:     http://www.linuxfromscratch.org/patches/blfs/svn/rpcbind-0.2.3-tirpc_fix-1.patch
13
+Vendor:     VMware, Inc.
14
+Distribution:   Photon
15
+BuildRequires:	libtirpc-devel
16
+BuildRequires:  systemd
17
+Requires:       libtirpc
18
+Requires:       systemd
19
+%description
20
+The rpcbind program is a replacement for portmap. It is required for import or export of Network File System (NFS) shared directories. The rpcbind utility is a server that converts RPC program numbers into universal addresses
21
+%prep
22
+%setup -q
23
+%patch0 -p1
24
+%build
25
+sed -i "/servname/s:rpcbind:sunrpc:" src/rpcbind.c
26
+./configure --prefix=%{_prefix}      \
27
+            --bindir=%{_sbindir}     \
28
+            --enable-warmstarts \
29
+            --disable-debug \
30
+            --with-statedir=%{_localstatedir}/lib/rpcbind \
31
+            --with-rpcuser=rpc
32
+make
33
+%install
34
+make DESTDIR=%{buildroot} install
35
+mkdir -p %{buildroot}%{_localstatedir}/lib/rpcbind
36
+mkdir -p %{buildroot}%{_unitdir}
37
+mkdir -p %{buildroot}/etc/sysconfig
38
+install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
39
+install -m644 %{SOURCE2} %{buildroot}%{_unitdir}
40
+install -m644 %{SOURCE3} %{buildroot}/etc/sysconfig/rpcbind
41
+
42
+%files
43
+%defattr(-,root,root)
44
+%config(noreplace) /etc/sysconfig/rpcbind
45
+%{_sbindir}/*
46
+%{_mandir}/man8/*
47
+%dir %{_localstatedir}/lib/rpcbind
48
+%{_unitdir}/*
49
+
50
+%check
51
+make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
52
+%post
53
+/sbin/ldconfig
54
+chown -v root:sys /var/lib/rpcbind
55
+if ! getent group rpc >/dev/null; then
56
+	groupadd -g 31 rpc
57
+fi
58
+if ! getent passwd rpc >/dev/null; then
59
+	useradd -d /var/lib/rpcbind -g rpc -s /bin/false -u 31 rpc
60
+fi
61
+systemctl enable rpcbind.socket >/dev/null 2>&1
62
+systemctl enable rpcbind.service >/dev/null 2>&1
63
+
64
+
65
+%postun
66
+/sbin/ldconfig
67
+if getent passwd rpc >/dev/null; then
68
+	userdel rpc
69
+fi
70
+if getent group rpc >/dev/null; then
71
+	groupdel rpc
72
+fi
73
+systemctl disable rpcbind.socket >/dev/null 2>&1
74
+systemctl disable rpcbind.service >/dev/null 2>&1
75
+%clean
76
+rm -rf %{buildroot}/*
77
+%changelog
78
+*	Tue Dec 8 2015 Divya Thaluru <dthaluru@vmware.com> 0.2.3-1
79
+-	Initial build.	First version
0 80
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+#
1
+# Optional arguments passed to rpcbind. See rpcbind(8)
2
+RPCBIND_OPTIONS=""
3
+