Few changes on the %pre and %post sections of the rh specfile to handle
authormorcego <morcego@users.sourceforge.net>
Thu, 7 Mar 2002 00:11:57 +0000 (00:11 +0000)
committermorcego <morcego@users.sourceforge.net>
Thu, 7 Mar 2002 00:11:57 +0000 (00:11 +0000)
usernames more cleanly

junkbuster-rh.spec

index 8ac5aba..82503ff 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: junkbuster-rh.spec,v 1.32 2002/03/05 12:34:24 morcego Exp $
+# $Id: junkbuster-rh.spec,v 1.33 2002/03/05 13:13:57 morcego Exp $
 #
 # Written by and Copyright (C) 2001 the SourceForge
 # IJBSWA team.  http://ijbswa.sourceforge.net
 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 # $Log: junkbuster-rh.spec,v $
+# Revision 1.33  2002/03/05 13:13:57  morcego
+# - Added "make redhat-dok" to the build phase
+# - Added docbook-utils to BuildRequires
+#
 # Revision 1.32  2002/03/05 12:34:24  morcego
 # - Changing section internaly on the manpage from 1 to 8
 # - We now require packages, not files, to avoid issues with apt
@@ -144,7 +148,7 @@ Summary: The Internet Junkbuster
 Vendor: http://ijbswa.sourceforge.net
 Name: junkbuster
 Version: 2.9.11
-Release: 5
+Release: 6
 Source0: http://www.waldherr.org/%{name}/ijbswa-%{version}.tar.gz
 License: GPL
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -152,7 +156,7 @@ Group: Networking/Utilities
 URL: http://ijbswa.sourceforge.net/
 Obsoletes: junkbuster-raw junkbuster-blank
 # Prereq: /usr/sbin/useradd , /sbin/chkconfig , /sbin/service 
-Prereq: shadow-utils, chkconfig, initscripts
+Prereq: shadow-utils, chkconfig, initscripts, sh-utils
 BuildRequires: perl gzip sed docbook-utils
 Conflicts: junkbuster-raw junkbuster-blank
 
@@ -178,9 +182,6 @@ make redhat-dok
 ## anyone wants to build an unstriped version - morcego
 #strip %{name}
 
-%pre
-/usr/sbin/useradd -d /etc/%{name} -r %{name} -s "" > /dev/null 2>&1 || /bin/true
-
 %install
 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
 mkdir -p %{buildroot}%{_sbindir} \
@@ -231,6 +232,14 @@ perl -pe 's/{-no-cookies}/{-no-cookies}\n\.redhat.com/' ijb.action >\
 ## -- morcego
 #%%makeinstall
 
+%pre
+# We check to see if the user junkbuster exists.
+# If it does, we do nothing
+# If we don't, we check to see if the user junkbust exist and, in case it
+# does, we change it do junkbuster. If it also does not exist, we create the
+# junkbuster user -- morcego
+id junkbuster > /dev/null 2>&1 || ( id junkbust && ( /usr/sbin/usermod -l junkbuster junkbust ) || ( /usr/sbin/useradd -d /etc/%{name} -r %{name} -s "" > /dev/null 2>&1 || /bin/true )
+
 %post
 # for upgrade from 2.0.x
 [ -f %{_localstatedir}/log/%{name}/%{name} ] &&\
@@ -242,7 +251,8 @@ if [ "$1" = "1" ]; then
        /sbin/service %{name} condrestart > /dev/null 2>&1
 fi
 # 01/09/02 HB, getting rid of any user=junkbust
-grep junkbust: /etc/passwd >/dev/null && userdel junkbust || /bin/true
+# Changed by morcego to use the id command.
+id junkbust > /dev/null 2>&1 && /usr/sbin/userdel junkbust || /bin/true
 
 %preun
 if [ "$1" = "0" ]; then
@@ -269,9 +279,9 @@ fi
 
 %dir %{ijbconf}
 %dir %{ijbconf}/templates
-%attr(0744,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
+%attr(0744,junkbuster,junkbuster) %dir %{_localstatedir}/log/%{name}
 
-%attr(0744,%{name},%{name})%{_sbindir}/%{name}
+%attr(0744,junkbuster,junkbuster)%{_sbindir}/%{name}
 
 # We should not use wildchars here. This could mask missing files problems
 # -- morcego
@@ -316,6 +326,13 @@ fi
 %{_mandir}/man8/%{name}.8*
 
 %changelog
+* Tue Mar 06 2002 Rodrigo Barbosa <rodrigob@tisbrasil.com.br>
++ junkbuster-2.9.11-6
+- Changed the routined that handle the junkbust and junkbuster users on
+  %%pre and %%post to work in a smoother manner
+- %%files now uses hardcoded usernames, to avoid problems with package
+  name changes in the future
+
 * Tue Mar 05 2002 Rodrigo Barbosa <rodrigob@tisbrasil.com.br>
 + junkbuster-2.9.11-5
 - Added "make redhat-dok" to the build process