diff --git a/rpcbind.spec b/rpcbind.spec index f614049..9f66586 100644 --- a/rpcbind.spec +++ b/rpcbind.spec @@ -77,20 +77,16 @@ rm -rf %{buildroot} %pre -# Check the validity of the rpc uid and gid. -# If they don't exist, create them -# If they exist but are the wrong value, remove them -# and recreate them with the correct value -# If they exist and are the correct value do nothing -rpcid=`getent passwd rpc | cut -d: -f 3` -if [ -n "$rpcid" -a "$rpcid" != "32" ]; then - /usr/sbin/userdel rpc 2> /dev/null || : - /usr/sbin/groupdel rpc 2> /dev/null || : -fi -if [ -z "$rpcid" -o "$rpcid" != "32" ]; then - /usr/sbin/groupadd -o -g 32 rpc > /dev/null 2>&1 - /usr/sbin/useradd -o -l -c "Rpcbind Daemon" -d /var/lib/rpcbind -g 32 \ - -M -s /sbin/nologin -u 32 rpc > /dev/null 2>&1 +# Softly static allocate the rpc uid and gid. +getent group rpc >/dev/null || groupadd -f -g 32 -r rpc +if ! getent passwd rpc >/dev/null ; then + if ! getent passwd 32 >/dev/null ; then + useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind \ + -g rpc -M -s /sbin/nologin -o -u 32 rpc > /dev/null 2>&1 + else + useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind \ + -g rpc -M -s /sbin/nologin rpc > /dev/null 2>&1 + fi fi %post @@ -98,10 +94,6 @@ fi %preun %systemd_preun rpcbind.service rpcbind.socket -if [ $1 -eq 0 ]; then - /usr/sbin/userdel rpc 2>/dev/null || : - /usr/sbin/groupdel rpc 2>/dev/null || : -fi %postun %systemd_postun_with_restart rpcbind.service rpcbind.socket @@ -129,6 +121,7 @@ fi %changelog * Mon Apr 4 2016 Steve Dickson - 0.2.3-10.rc1 - Restart rpcbind.socket on restarts (bz 1306824) +- Soft static allocate rpc uid/gid (bz 1301288) * Sat Feb 20 2016 Steve Dickson - 0.2.3-9.rc1 - Updated to the latest RC release rpcbind-0_2_4-rc1