[interchange-cvs] interchange - jon modified 4 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Mon Jun 17 17:40:01 2002


User:      jon
Date:      2002-06-17 21:39:19 GMT
Modified:  SPECS    interchange.spec
Added:     SPECS    interchange-init interchange-logrotate
Added:              interchange-wrapper
Log:
Merge in updates RPM build files from 4.8 branch,
tweak a few minor things for 4.9.

Revision  Changes    Path
2.10      +266 -358  interchange/SPECS/interchange.spec


rev 2.10, prev_rev 2.9
Index: interchange.spec
===================================================================
RCS file: /var/cvs/interchange/SPECS/interchange.spec,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -u -r2.9 -r2.10
--- interchange.spec	20 Dec 2001 06:16:50 -0000	2.9
+++ interchange.spec	17 Jun 2002 21:39:19 -0000	2.10
@@ -1,81 +1,64 @@
-%define ic_version			4.9.0
-%define ic_rpm_release		1
-%define ic_package_basename	interchange
 %define ic_user				interch
 %define ic_group			interch
-# Currently only one demo catalog name may be specified,
-# and it must also be the skeleton name.
-%define cat_name foundation
 
+%define filelist %{_tmppath}/%{name}-%{version}.filelist
+%define webdir /var/www
 
-Summary: Interchange - a database access and HTML templating system focused on ecommerce
-Name: %ic_package_basename
-Version: %ic_version
-Release: %ic_rpm_release
+
+Summary: Interchange web application platform
+Name: interchange
+Version: 4.9.1
+Release: 1
 Vendor: Red Hat, Inc.
-License: GPL
+Group: System Environment/Daemons
+BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
 URL: http://interchange.redhat.com/
-Packager: Interchange Development Team <interchange@redhat.com>
-Source: http://interchange.redhat.com/interchange/interchange-%{ic_version}.tar.gz
-Group: Applications/Internet
+Source0: http://interchange.redhat.com/interchange/interchange-%{version}.tar.gz
+Source1: interchange-wrapper
+Source2: interchange-init
+Source3: interchange-logrotate
+License: GPL
+Prereq: /sbin/chkconfig, /sbin/service, /usr/sbin/useradd, /usr/sbin/groupadd
 Requires: perl >= 5.005
+Requires: perl-Business-UPS
+Requires: perl-Digest-MD5
+Requires: perl-MIME-Base64
+Requires: perl-Safe-Hole
+Requires: perl-SQL-Statement
+Requires: perl-Storable
+Requires: perl-URI
+Requires: perl-libnet
+Requires: perl-libwww-perl
 BuildPrereq: perl >= 5.005
-Provides: %ic_package_basename
-Obsoletes: %ic_package_basename
-BuildArch: noarch i386
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
 
 %description
-Interchange is the most powerful free ecommerce system available today.
-
-
-%package %cat_name
-Summary: Interchange Foundation skeleton - a template for building your own store
-Group: Applications/Internet
-Requires: %ic_package_basename
-Provides: %{ic_package_basename}-%cat_name
-Obsoletes: %{ic_package_basename}-%cat_name
+Interchange is a complete web application platform focused on
+ecommerce, dynamic data presentation, and content management.
 
-%description %cat_name
-The Foundation Store is a basic catalog you can adapt to build your own store.
 
+%package foundation
+Summary: A template store for Interchange
+Group: System Environment/Daemons
+Requires: interchange = %{version}-%{release}
 
-%package %{cat_name}-demo
-Summary: Interchange Foundation demo - a prebuilt demonstration store
-Group: Applications/Internet
-Prereq: %ic_package_basename
-Requires: %ic_package_basename
-Provides: %{ic_package_basename}-%{cat_name}-demo
-Obsoletes: %{ic_package_basename}-%{cat_name}-demo
+%description foundation
+The Foundation Store is a full-featured ecommerce catalog you can
+adapt to build your own store.
 
-%description %{cat_name}-demo
-This demo is a prebuilt installation of the Foundation Store that makes
-it easy to try out a number of Interchange's features.
 
+%package foundation-demo
+Summary: A prebuilt demonstration store for Interchange
+Group: System Environment/Daemons
+Prereq: interchange = %{version}-%{release}
 
-%define warning_file %{_docdir}/%{ic_package_basename}-%{version}/WARNING_YOU_ARE_MISSING_SOMETHING
-%define filelist_main %{_tmppath}/%{name}-%{version}.filelist
-
-# if user su'd to root but didn't get /usr/sbin added to the PATH,
-# we need to get to it on our own
-%define useradd %( which useradd || echo /usr/sbin/useradd )
-
-# Find base directory for web files
-# Red Hat Linux 7: /var/www
-# Red Hat Linux 6: /home/httpd
-%define webdir %( if [ -d /var/www ]; then echo -n '/var/www' ; else echo -n '/home/httpd' ; fi )
-
-# This is obviously a terrible oversimplification of whether the build system
-# is Red Hat Linux 7 or not, but it has worked so far.
-#%define interchange_rpm_subrelease %( if [ "%webdir" = "/var/www" ]; then echo -n rh7 ; else echo -n rh6 ; fi )
+%description foundation-demo
+This demo is a prebuilt installation of the Foundation Store that
+makes it easy to test drive Interchange's ecommerce features.
 
 
 %prep
-
 %setup -q
 
-
 %build
 
 if test -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/"
@@ -83,46 +66,33 @@
 	echo "RPM_BUILD_ROOT has stupid value"
 	exit 1
 fi
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT
+%__rm -rf $RPM_BUILD_ROOT
+%__mkdir_p $RPM_BUILD_ROOT
 
-ETCBASE=/etc
-RUNBASE=/var/run
-LOGBASE=/var/log
-LIBBASE=/var/lib
-CACHEBASE=/var/cache
+ETCBASE=%{_sysconfdir}
+RUNBASE=%{_localstatedir}/run
+LOGBASE=%{_localstatedir}/log
+LIBBASE=%{_localstatedir}/lib
+CACHEBASE=%{_localstatedir}/cache
 ICBASE=%{_libdir}/interchange
 
-# Create an interch user if one doesn't already exist (on build machine).
-if [ -z "`grep '^%{ic_user}:' /etc/passwd`" ]
-then
-	if [ -n "`grep ^%{ic_group}: /etc/group`" ]
-	then
-		GROUPOPT='-g %{ic_group}'
-	else
-		GROUPOPT=
-	fi
-	%useradd -M -r -d $LIBBASE/interchange -s /bin/bash -c "Interchange server" $GROUPOPT %ic_user
-fi
-
 # Install Interchange
-perl Makefile.PL \
+%__perl Makefile.PL \
 	rpmbuilddir=$RPM_BUILD_ROOT \
 	INTERCHANGE_USER=%ic_user \
 	PREFIX=$RPM_BUILD_ROOT$ICBASE \
 	INSTALLMAN1DIR=$RPM_BUILD_ROOT%{_mandir}/man1 \
 	INSTALLMAN3DIR=$RPM_BUILD_ROOT%{_mandir}/man8 \
 	force=1
-make
-make test
-make install
-gzip $RPM_BUILD_ROOT%{_mandir}/man*/*
+%__make
+%__make test
+%__make NOCPANINSTALL=1 install
 
 # Copy over extra stuff that usually stays in source directory
-mkdir -p $RPM_BUILD_ROOT$ICBASE/build
-cp extra/HTML/Entities.pm $RPM_BUILD_ROOT$ICBASE/build
-cp extra/IniConf.pm $RPM_BUILD_ROOT$ICBASE/build
-cp -R -p eg extensions $RPM_BUILD_ROOT$ICBASE
+%__mkdir_p $RPM_BUILD_ROOT$ICBASE/build
+%__cp -p extra/HTML/Entities.pm $RPM_BUILD_ROOT$ICBASE/build
+%__cp -p extra/IniConf.pm $RPM_BUILD_ROOT$ICBASE/build
+%__cp -R -p eg extensions $RPM_BUILD_ROOT$ICBASE
 
 # Tell Perl where to find IC libraries during build time
 export PERL5LIB=$RPM_BUILD_ROOT$ICBASE/lib
@@ -130,133 +100,47 @@
 
 # Fix paths of link file in compile script
 cd $RPM_BUILD_ROOT$ICBASE
-perl -pi -e "s:^(\s+)LINK_FILE(\s+)=>.*:\$1LINK_FILE\$2=> \"$RUNBASE/interchange/socket\",:" bin/compile_link
+%__perl -pi -e "s:^(\s+)LINK_FILE(\s+)=>.*:\$1LINK_FILE\$2=> \"$RUNBASE/interchange/socket\",:" bin/compile_link
 
 # Build link program
-#bin/compile_link -build src
+bin/compile_link -build src
 
-mkdir -p $RPM_BUILD_ROOT$LIBBASE/interchange
-mkdir -p $RPM_BUILD_ROOT$RUNBASE/interchange
-mkdir -p $RPM_BUILD_ROOT$LOGBASE/interchange
-mkdir -p $RPM_BUILD_ROOT$CACHEBASE/interchange
-
-# Make SysV-style system startup/shutdown script
-mkdir -p $RPM_BUILD_ROOT$ETCBASE/rc.d/init.d
-cat > $RPM_BUILD_ROOT$ETCBASE/rc.d/init.d/interchange <<EOF
-#!/bin/sh
-#
-# Run control script for Interchange
-# http://interchange.redhat.com/
-#
-# chkconfig: 345 96 4
-# description: Interchange is a database access and HTML templating system focused on ecommerce
-# processname: interchange
-# pidfile: $RUNBASE/interchange/interchange.pid
-# config: $ETCBASE/interchange.cfg
-# config: $LIBBASE/interchange/*/catalog.cfg
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# See how we were called.
-case "\$1" in
-	start)
-		echo -n "Starting Interchange: "
-		daemon interchange -q
-		echo
-		touch /var/lock/subsys/interchange
-		;;
-	stop)
-		echo -n "Shutting down Interchange: "
-		killproc interchange
-		echo
-		rm -f /var/lock/subsys/interchange
-		rm -f $RUNBASE/interchange/interchange.pid
-		;;
-	status)
-		status interchange
-		;;
-	restart)
-		\$0 stop
-		\$0 start
-		;;
-	*)
-		echo "Usage: \$0 {start|stop|restart|status}"
-		exit 1
-esac
-
-exit 0
-EOF
-chmod +x $RPM_BUILD_ROOT$ETCBASE/rc.d/init.d/interchange
-
-# Make log rotation script
-mkdir -p $RPM_BUILD_ROOT$ETCBASE/logrotate.d
-cat > $RPM_BUILD_ROOT$ETCBASE/logrotate.d/interchange <<EOF
-/var/log/interchange/*.log {
-	rotate 4
-	weekly
-	compress
-}
-
-/var/log/interchange/*/error.log {
-	rotate 4
-	weekly
-	compress
-}
-
-/var/log/interchange/*/logs/usertrack {
-	rotate 12
-	monthly
-	compress
-}
-EOF
-
-# Make special Interchange start/stop script with RPM-specific paths
-mkdir -p $RPM_BUILD_ROOT%{_sbindir}
-cat > $RPM_BUILD_ROOT%{_sbindir}/interchange <<EOF
-#!/bin/sh
-
-# Interchange control script
-# Calls Interchange with special locations of files as installed by RPM
-# http://interchange.redhat.com/
-
-RUNSTRING="%{_libdir}/interchange/bin/interchange \\
-	-configfile $ETCBASE/interchange.cfg \\
-	-pidfile $RUNBASE/interchange/interchange.pid \\
-	-logfile $LOGBASE/interchange/error.log \\
-	ErrorFile=$LOGBASE/interchange/error.log \\
-	PIDfile=$RUNBASE/interchange/interchange.pid \\
-	-confdir $ICBASE/etc \\
-	-rundir $RUNBASE/interchange \\
-	SocketFile=$RUNBASE/interchange/socket \\
-	IPCsocket=$RUNBASE/interchange/socket.ipc"
-
-if test "\`whoami\`" = root
-then 
-	exec su %ic_user -c "\$RUNSTRING \$*"
-else
-	exec \$RUNSTRING \$*
-fi
-EOF
-chmod +x $RPM_BUILD_ROOT%{_sbindir}/interchange
+%__mkdir_p $RPM_BUILD_ROOT$LIBBASE/interchange
+%__mkdir_p $RPM_BUILD_ROOT$RUNBASE/interchange
+%__mkdir_p $RPM_BUILD_ROOT$LOGBASE/interchange
+%__mkdir_p $RPM_BUILD_ROOT$CACHEBASE/interchange
+
+# Install wrapper script
+%__mkdir_p $RPM_BUILD_ROOT%{_sbindir}
+%__install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/interchange
+
+# Install SysV-style system startup/shutdown script
+%__mkdir_p $RPM_BUILD_ROOT$ETCBASE/rc.d/init.d
+%__install -m755 %{SOURCE2} $RPM_BUILD_ROOT$ETCBASE/rc.d/init.d/interchange
+
+# Install log rotation script
+%__mkdir_p $RPM_BUILD_ROOT$ETCBASE/logrotate.d
+%__install -m644 %{SOURCE3} $RPM_BUILD_ROOT$ETCBASE/logrotate.d/interchange
 
 # Build the demo catalog
 HOST=RPM_CHANGE_HOST
-BASEDIR=/var/lib/interchange
-LOGDIR=/var/log/interchange
-CACHEDIR=/var/cache/interchange
+BASEDIR=%{_localstatedir}/lib/interchange
+LOGDIR=%{_localstatedir}/log/interchange
+CACHEDIR=%{_localstatedir}/cache/interchange
 DOCROOT=%{webdir}/html
 CGIDIR=%{webdir}/cgi-bin
 CGIBASE=/cgi-bin
-HTTPDCONF=/etc/httpd/conf/httpd.conf
-for i in %cat_name
+HTTPDCONF=%{_sysconfdir}/httpd/conf/httpd.conf
+for i in foundation
 do 
-	mkdir -p $RPM_BUILD_ROOT$CGIDIR
-	mkdir -p $RPM_BUILD_ROOT$DOCROOT/$i/images
-	mkdir -p $RPM_BUILD_ROOT$BASEDIR/$i
+	%__mkdir_p $RPM_BUILD_ROOT$CGIDIR
+	%__mkdir_p $RPM_BUILD_ROOT$DOCROOT/$i/images
+	%__mkdir_p $RPM_BUILD_ROOT$BASEDIR/$i
 	bin/makecat \
 		-F \
 		--relocate=$RPM_BUILD_ROOT \
+		--nocfg \
+		--norunning \
 		--demotype=$i \
 		--catalogname=$i \
 		--basedir=$BASEDIR \
@@ -281,22 +165,29 @@
 		--catuser=%ic_user \
 		--mailorderto=%{ic_user}@$HOST \
 		cachedir=$CACHEDIR/$i \
-		logdir=$LOGDIR/$i
+		logdir=$LOGDIR/$i \
+		demomode=1
 done
 
+# Remove admin UI images now that they're in the HTML doc root
+%__rm -rf $RPM_BUILD_ROOT$ICBASE/share/interchange
+
+# Clean up empty placeholder files used to keep CVS from pruning away
+# otherwise empty directories
+find $RPM_BUILD_ROOT -type f -name .empty \( -size 0b -o -size 1b \) -exec %__rm -f \{\} \;
+
 # Put interchange.cfg in /etc instead of IC software directory
-mv interchange.cfg $RPM_BUILD_ROOT$ETCBASE/interchange.cfg
-ln -s $ETCBASE/interchange.cfg
+%__mv interchange.cfg.dist $RPM_BUILD_ROOT$ETCBASE/interchange.cfg
+%__ln_s $ETCBASE/interchange.cfg
 
 # Put global error log in /var/log/interchange instead of IC software directory
 RPMICLOG=$LOGBASE/interchange/error.log
-rm -f error.log
-ln -s $RPMICLOG
+%__rm -f error.log
+%__ln_s $RPMICLOG
 touch $RPM_BUILD_ROOT$RPMICLOG
-chown %{ic_user}.%ic_group $RPM_BUILD_ROOT$RPMICLOG
 
-# Make a symlink from docroot area into /usr{/share}/doc/interchange-x.x.x.
-ln -s %{_docdir}/interchange-%ic_version $RPM_BUILD_ROOT$DOCROOT/interchange/doc
+# Make a symlink from docroot area into /usr/share/doc/interchange-x.x.x.
+%__ln_s %{_docdir}/interchange-%{version} $RPM_BUILD_ROOT$DOCROOT/interchange/doc
 
 # I don't know of a way to exclude a subdirectory from one of the directories
 # listed in the %files section, so I have to use this monstrosity to generate
@@ -304,10 +195,10 @@
 # directory and pass the list to %files below.
 DIRDEPTH=`echo $ICBASE | sed 's:[^/]::g' | awk '{print length + 1}'`
 cd $RPM_BUILD_ROOT
-find . -path .$ICBASE/%cat_name -prune -mindepth $DIRDEPTH -maxdepth $DIRDEPTH \
-	-o -print | grep "^\.$ICBASE" | sed 's:^\.::' | \
-	sed 's:^\(/usr/lib/interchange/etc\):%attr(-, %{ic_user}, %{ic_group}) \1:' \
-	> %filelist_main
+find . -path .$ICBASE/foundation -prune -mindepth $DIRDEPTH -maxdepth $DIRDEPTH \
+	-o -print | %__grep "^\.$ICBASE" | sed 's:^\.::' | \
+	%__sed 's:^\(/usr/lib/interchange/etc\):%attr(-, %{ic_user}, %{ic_group}) \1:' \
+	> %filelist
 
 
 %install
@@ -315,39 +206,29 @@
 
 %pre
 
-if test -x /etc/rc.d/init.d/interchange
-then
-	/etc/rc.d/init.d/interchange stop > /dev/null 2>&1
-	#echo "Giving interchange a couple of seconds to exit nicely" >&2
-	sleep 5
-fi
+/sbin/service interchange stop >/dev/null 2>&1 || :
 
-# Create an interch user if one doesn't already exist (on install machine).
-if [ -z "`grep '^%{ic_user}:' /etc/passwd`" ]
-then
-	if [ -n "`grep ^%{ic_group}: /etc/group`" ]
-	then
-		GROUPOPT='-g %{ic_group}'
-	else
-		GROUPOPT=
-	fi
-	%useradd -M -r -d /var/lib/interchange -s /bin/bash -c "Interchange server" $GROUPOPT %ic_user 2> /dev/null || true 
-fi
+# Create interch user/group if they don't already exist
+/usr/sbin/groupadd -g 52 %ic_group 2>/dev/null || :
+/usr/sbin/useradd -u 52 -g %ic_group -c "Interchange server" -s /bin/bash \
+	-r -d %{_localstatedir}/lib/interchange %ic_user 2>/dev/null || :
 
 
-%ifarch noarch
+%files foundation
 
-%files -f %filelist_main
+%defattr(-, root, root)
+%{_libdir}/interchange/foundation
+
+
+%files -f %filelist
 
 %defattr(-, %{ic_user}, %{ic_group})
 
-%dir /var/run/interchange
-%dir /var/cache/interchange
-%dir /var/log/interchange
-%dir /var/lib/interchange
-/var/log/interchange/error.log
-%config(noreplace) /etc/interchange.cfg
-%{webdir}/html/interchange
+%dir %{_localstatedir}/run/interchange
+%dir %{_localstatedir}/cache/interchange
+%dir %{_localstatedir}/log/interchange
+%dir %{_localstatedir}/lib/interchange
+%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/interchange.cfg
 
 %defattr(-, root, root)
 
@@ -355,183 +236,210 @@
 %doc README
 %doc README.rpm-dist
 %doc README.cvs
+%doc UPGRADE
 %doc WHATSNEW
-%{_mandir}/man1
-%{_mandir}/man8
-%config(noreplace) /etc/rc.d/init.d/interchange
-%config(noreplace) /etc/logrotate.d/interchange
-%config(noreplace) %{_sbindir}/interchange
+%config(noreplace) %{_sysconfdir}/logrotate.d/interchange
+%config %{_sysconfdir}/rc.d/init.d/interchange
+%{_sbindir}/interchange
 %dir %{_libdir}/interchange
+%{webdir}/html/interchange
+%{_mandir}/*/*
 
 
-%files %cat_name
-
-%defattr(-, root, root)
-%{_libdir}/interchange/%cat_name
-
-
-%else
-
-
-%files %{cat_name}-demo
+%files foundation-demo
 
 %defattr(-, %{ic_user}, %{ic_group})
-/var/lib/interchange/%cat_name
-/var/log/interchange/%cat_name
-/var/cache/interchange/%cat_name
-%{webdir}/html/%cat_name
-%{webdir}/cgi-bin/%cat_name
-
-%endif
+%{_localstatedir}/lib/interchange/foundation
+%{_localstatedir}/log/interchange/foundation
+%{_localstatedir}/cache/interchange/foundation
+%{webdir}/html/foundation
+%{webdir}/cgi-bin/foundation
 
 
 %post
 
-# Make Interchange start/stop automatically with the operating system.
-/sbin/chkconfig --add interchange
+# Create the error log if it doesn't exist
+if [ ! -f %{_localstatedir}/log/interchange/error.log ]; then
+    touch %{_localstatedir}/log/interchange/error.log
+    %__chown %{ic_user}.%{ic_group} %{_localstatedir}/log/interchange/error.log
+fi
+
+# Optionally set Interchange to start/stop with the operating system.
+#/sbin/chkconfig --add interchange
 
 # Get to a place where no random Perl libraries should be found
 cd /usr
 
-status=`perl -e "require HTML::Entities and print 1;" 2>/dev/null`
+# Install private copies of key CPAN modules if necessary
+status=`%__perl -e "require HTML::Entities and print 1;" 2>/dev/null`
 if test "x$status" != x1
 then
-	mkdir -p %{_libdir}/interchange/lib/HTML 2>/dev/null
-	cp -p %{_libdir}/interchange/build/Entities.pm %{_libdir}/interchange/lib/HTML 2>/dev/null
+	%__mkdir_p %{_libdir}/interchange/lib/HTML 2>/dev/null
+	%__cp -p %{_libdir}/interchange/build/Entities.pm %{_libdir}/interchange/lib/HTML 2>/dev/null
 fi
 
-status=`perl -e "require IniConf and print 1;" 2>/dev/null`
+status=`%__perl -e "require IniConf and print 1;" 2>/dev/null`
 if test "x$status" != x1
 then
-	cp -p %{_libdir}/interchange/build/IniConf.pm %{_libdir}/interchange/lib 2>/dev/null
+	%__cp -p %{_libdir}/interchange/build/IniConf.pm %{_libdir}/interchange/lib 2>/dev/null
 fi
 
-status=`perl -e "require Storable and print 1;" 2>/dev/null`
+# Storable is technically optional; be careful in case user
+# installed with --nodeps
+status=`%__perl -e "require Storable and print 1;" 2>/dev/null`
 if test "x$status" != x1
 then
-	rm -f %{_libdir}/interchange/_*storable
+	%__rm -f %{_libdir}/interchange/_*storable
 fi
 
-missing=
-for i in Digest::MD5 MIME::Base64 URI::URL SQL::Statement Safe::Hole
-do
-	status=`perl -e "require $i and print 1;" 2>/dev/null`
-	if test "x$status" != x1
-	then
-		missing="$missing $i"
-	fi
-done
-
-if test -n "$missing"
-then
-	{
-		echo ""
-		echo "Missing Perl modules:"
-		echo ""
-		echo "$missing"
-		echo ""
-		echo "Interchange catalogs will work without them, but the admin interface will not."
-		echo "You need to install these modules before you can use the admin interface."
-		echo ""
-		echo "You can find the appropriate RPM packages at:"
-		echo ""
-		echo "http://interchange.redhat.com/"
-		echo ""
-		echo "Or, as a last resort, you can build and install them from source. Try:"
-		echo ""
-		echo 'perl -MCPAN -e "install Bundle::Interchange"'
-		echo ""
-	} > %warning_file
-fi
 
-
-%post %{cat_name}-demo
+%post foundation-demo
 
 HOST=`hostname`
-perl -pi -e "s/RPM_CHANGE_HOST/$HOST/g" \
-	/var/lib/interchange/%{cat_name}/catalog.cfg \
-	/var/lib/interchange/%{cat_name}/products/*.txt \
-	/var/lib/interchange/%{cat_name}/products/*.asc \
-	/var/lib/interchange/%{cat_name}/config/* \
-	%{webdir}/html/%{cat_name}/index.html
 
-for i in %cat_name
-do 
-	# Add the new catalog to the running Interchange daemon
-	if test -x /etc/rc.d/init.d/interchange && test -n \
-		"`/etc/rc.d/init.d/interchange status | grep 'interchange.*is running'`"
-	then
-		catline="`grep \"^[ \t]*Catalog[ \t][ \t]*$i[ \t]\" /etc/interchange.cfg`"
-		if [ -n "$catline" ]
-		then
-			echo "$catline" | %{_sbindir}/interchange --add=$i > /dev/null 2>&1
-		fi
-	fi
-done
+i=foundation
+%__perl -pi -e "s/RPM_CHANGE_HOST/$HOST/g" \
+	%{_localstatedir}/lib/interchange/$i/catalog.cfg \
+	%{_localstatedir}/lib/interchange/$i/products/*.txt \
+	%{_localstatedir}/lib/interchange/$i/products/*.asc \
+	%{_localstatedir}/lib/interchange/$i/config/* \
+	%{webdir}/html/$i/index.html
+
+# Add Catalog directive to interchange.cfg
+ICCFG=%{_sysconfdir}/interchange.cfg
+catline="`%__grep -i \"^#*[ \t]*Catalog[ \t][ \t]*$i[ \t]\" $ICCFG`"
+if [ -z "$catline" ]; then
+	catline="Catalog  $i  /var/lib/interchange/$i  /cgi-bin/$i"
+	%__perl -pi -e "next if ! /^\s*#\s*Catalog\s/i or \$done; s,\$,\n$catline,; ++\$done" $ICCFG
+fi
+
+# Add the new catalog to the running Interchange daemon
+if [ -n "`/sbin/service interchange status 2>/dev/null | %__grep -i 'interchange.*is running'`" ]
+then
+	echo "$catline" | %{_sbindir}/interchange --add=$i > /dev/null 2>&1
+fi
 
 
 %preun
 
-if test -x /etc/rc.d/init.d/interchange
-then
+if [ $1 = 0 ]; then
 	# Stop Interchange if running
-	/etc/rc.d/init.d/interchange stop > /dev/null
+	/sbin/service interchange stop >/dev/null 2>&1
+
 	# Remove autostart of interchange
-	/sbin/chkconfig --del interchange
+	/sbin/chkconfig --del interchange 2>/dev/null
+
+	# Remove non-user data
+	%__rm -rf %{_localstatedir}/run/interchange/*
+	%__rm -rf %{_localstatedir}/cache/interchange/*
+	%__rm -rf %{_libdir}/interchange/lib/HTML
+	%__rm -rf %{_libdir}/interchange/etc/varnames
 fi
 
-# Remove non-user data
-rm -rf /var/run/interchange/*
-rm -rf /var/cache/interchange/*
-rm -rf %{_libdir}/interchange/lib/HTML
-rm -f %warning_file
 
+%preun foundation-demo
 
-%preun %{cat_name}-demo
+if [ $1 = 0 ]; then
+	i=foundation
 
-for i in %cat_name
-do
 	# Remove catalog from running Interchange
-	if test -x /etc/rc.d/init.d/interchange && test -n \
-		"`/etc/rc.d/init.d/interchange status | grep 'interchange.*is running'`"
+	if [ -n "`/sbin/service interchange status 2>/dev/null | %__grep -i 'interchange.*is running'`" ]
 	then
-		if test -x %{_sbindir}/interchage
-		then
-			%{_sbindir}/interchange --remove=$i > /dev/null 2>&1
-		fi
+		%{_sbindir}/interchange --remove=$i > /dev/null 2>&1
 	fi
 
 	# Remove Catalog directive from interchange.cfg
-	ICCFG=/etc/interchange.cfg
-	if [ -f $ICCFG ]
-	then
-		ICCFGTMP=/tmp/rpm.$$.interchange.cfg
-		grep -v "^[ \t]*Catalog[ \t][ \t]*$i[ \t]" $ICCFG > $ICCFGTMP && \
-			chown --reference=$ICCFG $ICCFGTMP && \
-			chmod --reference=$ICCFG $ICCFGTMP && \
-			mv $ICCFGTMP $ICCFG
+	if [ -e %{_sysconfdir}/interchange.cfg ]; then
+		%__perl -pi -e "s/^\s*Catalog\s+$i\s[^\n]+\n//i" %{_sysconfdir}/interchange.cfg
 	fi
 
 	# Remove leftover machine-generated files
-	rm -rf /var/cache/interchange/$i/tmp/*
-	rm -rf /var/cache/interchange/$i/session/*
-	rm -rf /var/log/interchange/$i/orders/*
-	rm -rf /var/log/interchange/$i/logs/*
-	rm -rf /var/lib/interchange/$i/products/*.db
-	rm -rf /var/lib/interchange/$i/products/products.txt.*
-	rm -rf /var/lib/interchange/$i/products/*.autonumber
-	rm -rf /var/lib/interchange/$i/products/*.numeric
-	rm -rf /var/lib/interchange/$i/etc/status.$i
-done
+	%__rm -rf %{_localstatedir}/cache/interchange/$i/tmp/*
+	%__rm -rf %{_localstatedir}/cache/interchange/$i/session/*
+	%__rm -rf %{_localstatedir}/log/interchange/$i/orders/*
+	%__rm -rf %{_localstatedir}/log/interchange/$i/logs/*
+	%__rm -rf %{_localstatedir}/lib/interchange/$i/products/*.db
+	%__rm -rf %{_localstatedir}/lib/interchange/$i/products/products.txt.*
+	%__rm -rf %{_localstatedir}/lib/interchange/$i/products/*.autonumber
+	%__rm -rf %{_localstatedir}/lib/interchange/$i/products/*.numeric
+	%__rm -rf %{_localstatedir}/lib/interchange/$i/etc/status.$i
+fi
 
 
 %clean
 
-rm -f %filelist_main
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+%__rm -f %filelist
+[ "$RPM_BUILD_ROOT" != "/" ] && %__rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon Jun 17 2002 Jon Jensen <jon@redhat.com> 4.9.1-1
+- Quell /sbin/service stop errors
+- Re-add main filelist omitted by oversight
+- On uninstall, remove autogenerated /usr/lib/interchange/etc/varnames
+- Stop duplicating admin UI share images in HTML doc root
+- Minor tweaks for 4.9 series
+
+* Tue May 07 2002 Jon Jensen <jon@redhat.com> 4.8.6-1
+- Turn off autostart
+- Pass on message if shutting down running Interchange daemon
+- Use macros for executables where possible
+- Stop gzipping manpages to allow default RPM compression
+  (bzip2 on recent Red Hat Linux)
+
+* Tue Apr 30 2002 Jon Jensen <jon@redhat.com> 4.8.4-9
+- Check package count in uninstall scripts.
+- Add Prereqs for system tools used
+- Let useradd and groupadd fail gracefully, rather than assuming interch
+  user will appear in /etc/passwd or /etc/group
+
+* Mon Apr 29 2002 Jon Jensen <jon@redhat.com>
+- Request uid and gid to be 52, Red Hat's assigned numbers for Interchange.
+- Start IC daemon in UNIX mode only by default.
+- Build foundation-demo with MV_DEMO_MODE set by default.
+- Back out Stronghold index.html patch.
+- Adapt a few more Gary-isms (manpage filelist, NOCPANINSTALL setting).
+
+* Fri Feb 15 2002 Jon Jensen <jon@redhat.com> 4.8.4-8
+- Keep foundation demo's Catalog directive out of interchange.cfg for
+  the base Interchange package; add it separately after installation.
+- Drop unneeded interchange.cfg.dist.
+- Quell some minor uninstall noise.
+
+* Wed Feb 13 2002 Gary Benson <gbenson@redhat.com> 4.8.4-7
+- made the init script more consistent with other RHL packages.
+
+* Wed Feb 13 2002 Gary Benson <gbenson@redhat.com>
+- don't ship an empty logfile in the brpm
+- use _sysconfdir and _localstatedir instead of /etc and /var
+
+* Tue Feb 12 2002 Gary Benson <gbenson@redhat.com>
+- replace ic_version, ic_rpm_release, etc. with version, release, etc.
+- remove cat_name definition, since "Foundation" appears multiple times.
+- tidy summaries and reflow descriptions.
+- remove provides self, obsoletes self and buildarch devilry.
+- change groups to System Environment/Daemons.
+- add versioned subpackage dependencies.
+- split init scripts and logrotate config into separate files.
+
+* Wed Jan 30 2002 Jon Jensen <jon@redhat.com> 4.8.4-6
+- Allow non-root RPM builds (required some changes to makecat as well).
+- Don't add interch user on build machine.
+- Allow easy en/disabling of daemon autostart with defined parameter
+  and default to off to prevent any surprises.
+- Start using Red Hat standard /sbin/service instead of directly running
+  /etc/rc.d/init.d/interchange.
+- Remove unneeded .empty files used in CVS to avoid pruning important but
+  empty directories.
+- Make admin UI images owned by root.
+- Don't include /usr/share/man/man[18] system directories in RPMs.
+- Start using RPM dependencies for Perl CPAN modules. Users who install
+  directly from CPAN will have to use --nodeps.
+- Make main interchange package architecture-dependent, because it includes
+  precompiled vlink and tlink CGIs, and we shouldn't require a C compiler
+  on the install machine if users run makecat later.
+- Stop checking for /home/httpd, but use a define for webdir that can
+  easily be changed if needed.
 
 * Wed Sep 19 2001 Jon Jensen <jon@redhat.com>
 - Add Prereq: interchange to interchange-foundation-demo because the demo



2.1       +43 -0     interchange/SPECS/interchange-init


rev 2.1, prev_rev 2.0



2.1       +17 -0     interchange/SPECS/interchange-logrotate


rev 2.1, prev_rev 2.0



2.1       +29 -0     interchange/SPECS/interchange-wrapper


rev 2.1, prev_rev 2.0