Browse code

rpcbind : Fix pre install script(git issue #736)

Change-Id: I2f6d279ac2b5a7047395347547949451d5a5407d
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4862
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Xiaolin Li authored on 2018/03/07 10:05:34
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        RPC program number mapper
2 2
 Name:           rpcbind
3 3
 Version:        0.2.4
4
-Release:        4%{?dist}
4
+Release:        5%{?dist}
5 5
 License:        BSD
6 6
 URL:            http://nfsv4.bullopensource.org
7 7
 Group:          Applications/Daemons
... ...
@@ -64,14 +64,13 @@ make %{?_smp_mflags} check
64 64
 %{_libdir}/systemd/system-preset/50-rpcbind.preset
65 65
 
66 66
 %pre
67
-rpcid=`getent passwd rpc | cut -d: -f 3`
68
-if [ -n "$rpcid" -a "$rpcid" != "31" ]; then
69
-    userdel  rpc 2> /dev/null || :
70
-    groupdel rpc 2> /dev/null || :
71
-fi
72
-if [ -z "$rpcid" -o "$rpcid" != "31" ]; then
73
-    groupadd -g 31 rpc > /dev/null 2>&1
67
+getent group rpc >/dev/null || groupadd -f -g 31 -r rpc
68
+if ! getent passwd rpc >/dev/null ; then
69
+if ! getent passwd 31 >/dev/null ; then
74 70
     useradd -d /var/lib/rpcbind -g rpc -s /bin/false -u 31 rpc > /dev/null 2>&1
71
+else
72
+    useradd -d /var/lib/rpcbind -g rpc -s /bin/false rpc > /dev/null 2>&1
73
+fi
75 74
 fi
76 75
 %preun
77 76
 %systemd_preun rpcbind.service rpcbind.socket
... ...
@@ -95,6 +94,8 @@ fi
95 95
 rm -rf %{buildroot}/*
96 96
 
97 97
 %changelog
98
+*   Tue Mar 06 2018 Xiaolin Li <xiaolinl@vmware.com> 0.2.4-5
99
+-   Fix pre install script.
98 100
 *   Mon Sep 18 2017 Alexey Makhalov <amakhalov@vmware.com> 0.2.4-4
99 101
 -   Remove coreutils from requires and use explicit tools for post actions
100 102
 *   Thu Jun 29 2017 Divya Thaluru <dthaluru@vmware.com>  0.2.4-3