SPECS: otrs.spec - webapps support, rel 1

glen glen at pld-linux.org
Sat Apr 15 15:38:06 CEST 2006


Author: glen                         Date: Sat Apr 15 13:38:06 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- webapps support, rel 1

---- Files affected:
SPECS:
   otrs.spec (1.64 -> 1.65) 

---- Diffs:

================================================================
Index: SPECS/otrs.spec
diff -u SPECS/otrs.spec:1.64 SPECS/otrs.spec:1.65
--- SPECS/otrs.spec:1.64	Tue Feb 28 09:51:59 2006
+++ SPECS/otrs.spec	Sat Apr 15 15:38:01 2006
@@ -4,15 +4,14 @@
 # - all otrs-var into /var/lib/otrs
 # - put cron in proper place
 # - write not so brain-damage init-script...
-# - apache1 bcond is wrong. ie needs update
 %bcond_with	apache1		# build for work with apache1 conf system
 %include	/usr/lib/rpm/macros.perl
+%define	vrel	01
 Summary:	The Open Ticket Request System
 Summary(pl):	Open Ticket Request System - otwarty system zgłaszania żądań
 Name:		otrs
 Version:	2.0.4
-%define	vrel	01
-Release:	0.4
+Release:	1
 Epoch:		1
 License:	GPL
 Group:		Applications/Databases
@@ -24,20 +23,14 @@
 Patch0:		%{name}-paths.patch
 URL:		http://otrs.org/
 BuildRequires:	rpm-perlprov
-BuildRequires:	rpmbuild(macros) >= 1.202
+BuildRequires:	rpmbuild(macros) >= 1.268
 Requires(pre):	/bin/id
 Requires(pre):	/usr/sbin/useradd
 Requires(pre):	/usr/sbin/usermod
-%if %{without apache1}
-Requires:	apache >= 2.0
-%endif
-%if %{with apache1}
-Requires:	apache1
-%endif
-Requires:	apache-mod_perl
-Requires:	mysql
+Requires:	apache(mod_perl)
 #Requires:	mysql-client
 #Requires:	perl-DBI
+Requires:	webapps
 Requires:	webserver = apache
 # Not catched:
 Requires:	perl-DBD-mysql
@@ -56,6 +49,8 @@
 %define		_noautoprov	'perl(Kernel::.*)'
 %define		otrsdir		%{_datadir}/otrs
 %define		otrsuser	otrs
+%define		_webapps	/etc/webapps
+%define		_webapp		%{name}
 
 %description
 OTRS is an Open source Ticket Request System with many features to
@@ -126,38 +121,35 @@
 %setup -q -n %{name}
 %patch0 -p1
 
-%build
 # copy config file
 cp Kernel/Config/GenericAgent.pm.dist Kernel/Config/GenericAgent.pm
 cd Kernel/Config/ && for foo in *.dist; do cp $foo `basename $foo .dist`; done && cd ../../
 # copy all crontab dist files
 for foo in var/cron/*.dist; do mv $foo var/cron/`basename $foo .dist`; done
 
-%install
-rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,httpd/httpd.conf,%{name}/Config,logrotate.d} \
-	$RPM_BUILD_ROOT{/var/log/{,archiv/}%{name},%{_bindir},%{otrsdir}} \
-	$RPM_BUILD_ROOT/var/lib/%{name}/{article,pics/stats}
-
 # Remove regular CPAN libs - only HTML/Safe.pm has to stay, I can't find it...
 rm -Rf Kernel/cpan-lib/{Authen,Date,Email,IO,MIME,Mail,XML,auto}
 # Remove junk:
 rm -Rf doc/manual/*/sgml/
 rm -Rf doc/manual/de/
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,%{name}/Config,logrotate.d} \
+	$RPM_BUILD_ROOT{/var/log/{,archiv/}%{name},%{_bindir},%{otrsdir}} \
+	$RPM_BUILD_ROOT/var/lib/%{name}/{article,pics/stats} \
+	$RPM_BUILD_ROOT%{_webapps}/%{_webapp}
+
 # copy files
 cp -R . $RPM_BUILD_ROOT%{otrsdir}
 
 # install init-Script & apache2 config
 install scripts/redhat-rcotrs $RPM_BUILD_ROOT/etc/rc.d/init.d/otrs
 install scripts/redhat-rcotrs-config $RPM_BUILD_ROOT/etc/sysconfig/otrs
-%if %{without apache1}
-	#apache2
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/httpd.conf/88_%{name}.conf
-%endif
-%if %{with apache1}
-	#apache 1
-	install %{SOURCE2} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
-%endif
+# apache 1
+install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
+# apache 2
+install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
 
 install %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
 
@@ -171,23 +163,23 @@
 mv -f $RPM_BUILD_ROOT%{otrsdir}/.mailfilter.dist $RPM_BUILD_ROOT/etc/%{name}/mailfilter
 mv -f $RPM_BUILD_ROOT%{otrsdir}/Kernel/Config.pm.dist $RPM_BUILD_ROOT/etc/%{name}/Config.pm
 mv -f $RPM_BUILD_ROOT%{otrsdir}/Kernel/Config/GenericAgent.pm $RPM_BUILD_ROOT/etc/%{name}
-#save dist versions
+# save dist versions
+# TODO: drop .dist and rely on rpm %config(noreplace) feature
 install $RPM_BUILD_ROOT/etc/%{name}/procmailrc $RPM_BUILD_ROOT/etc/%{name}/procmailrc.dist
 install $RPM_BUILD_ROOT/etc/%{name}/fetchmailrc $RPM_BUILD_ROOT/etc/%{name}/fetchmailrc.dist
 install $RPM_BUILD_ROOT/etc/%{name}/mailfilter $RPM_BUILD_ROOT/etc/%{name}/mailfilter.dist
 install $RPM_BUILD_ROOT/etc/%{name}/Config.pm $RPM_BUILD_ROOT/etc/%{name}/Config.pm.dist
 install $RPM_BUILD_ROOT/etc/%{name}/GenericAgent.pm $RPM_BUILD_ROOT/etc/%{name}/GenericAgent.pm.dist
 # File for on-line configuration:
-#touch $RPM_BUILD_ROOT/etc/%{name}/ZZZAAuto.pm
-#ln -sf /etc/otrs/ZZZAAuto.pm $RPM_BUILD_ROOT%{otrsdir}/Kernel/Files/ZZZAAuto.pm
-#link to proper places
+# touch $RPM_BUILD_ROOT/etc/%{name}/ZZZAAuto.pm
+# ln -sf /etc/otrs/ZZZAAuto.pm $RPM_BUILD_ROOT%{otrsdir}/Kernel/Files/ZZZAAuto.pm
+# link to proper places
 ln -sf ../../../etc/otrs/procmailrc $RPM_BUILD_ROOT%{otrsdir}/.procmailrc
 ln -sf ../../../etc/otrs/fetchmailrc $RPM_BUILD_ROOT%{otrsdir}/.fetchmailrc
 ln -sf ../../../etc/otrs/mailfilter $RPM_BUILD_ROOT%{otrsdir}/.mailfilter
 ln -sf ../../../../etc/otrs/Config.pm $RPM_BUILD_ROOT%{otrsdir}/Kernel/Config.pm
 ln -sf ../../../../../etc/otrs/GenericAgent.pm $RPM_BUILD_ROOT%{otrsdir}/Kernel/Config/GenericAgent.pm
 
-
 # Cleanup junk:
 rm -f $RPM_BUILD_ROOT%{otrsdir}/scripts/apache* $RPM_BUILD_ROOT%{otrsdir}/scripts/redhat* $RPM_BUILD_ROOT%{otrsdir}/scripts/suse*
 rm -rf $RPM_BUILD_ROOT%{otrsdir}/scripts/auto* $RPM_BUILD_ROOT%{otrsdir}/scripts/test
@@ -207,20 +199,45 @@
 /usr/sbin/usermod -d %{otrsdir} %{otrsuser}
 
 %post
-# if apache2
-if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
-        echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
+if [ "$1" = 0 ]; then
+	# note
+%banner -e %{name} <<EOF
+[install the OTRS database]
+ Use a webbrowser and open this link: http://`hostname -f`/otrs/installer.pl
+EOF
 fi
-if [ -f /var/lock/subsys/httpd ]; then
-	/etc/rc.d/init.d/httpd restart 1>&2
+
+%triggerin -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerpostun -- %{name} < 1:2.0.4-0.5
+# nuke very-old config location (this mostly for Ra)
+if [ -f /etc/httpd/httpd.conf ]; then
+	sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
 fi
-# note
-echo "[install the OTRS database]"
-echo " Use a webbrowser and open this link: http://`hostname -f`/otrs/installer.pl"
-
-%triggerpostun -- %{name} < 2.0.0
-echo "WARNING: you need to prepare %{name} upgrade!"
-echo "Read %{_docdir}/%{name}-%{version}UPGRADING.gz"
+
+# apache1 config?!
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+	cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+	mv -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
+fi
+# apache2 config
+if [ -f /etc/httpd/httpd.conf/88_otrs.conf.rpmsave ]; then
+	cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+	mv -f /etc/httpd/httpd.conf/88_otrs.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
+fi
+
+/usr/sbin/webapp register httpd %{_webapp}
+%service -q httpd reload
 
 %files
 %defattr(644,root,root,755)
@@ -327,14 +344,9 @@
 # %attr(755,otrs,http) %dir /var/lib/%{name}/spool
 # %attr(2775,otrs,http) %dir /var/lib/%{name}/tmp
 
-%if %{without apache1}
-# apache2
-%config(noreplace) %{_sysconfdir}/httpd/httpd.conf/88_%{name}.conf
-%endif
-%if %{with apache1}
-# apache1
-%config(noreplace) /etc/httpd/%{name}.conf
-%endif
+%dir %attr(750,root,http) %{_webapps}/%{_webapp}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
 
 %files scripts
 %defattr(644,root,root,755)
@@ -351,6 +363,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.65  2006/04/15 13:38:01  glen
+- webapps support, rel 1
+
 Revision 1.64  2006/02/28 08:51:59  luzik
 - security update to 2.0.4
 - STBR for sec.
@@ -377,7 +392,7 @@
 - cometics
 
 Revision 1.56  2005/11/03 09:54:43  luzik
- - updated to 2.0.3, not tested
+- updated to 2.0.3, not tested
 
 Revision 1.55  2005/05/01 17:31:30  glen
 - use %useradd/%groupadd macros
@@ -395,10 +410,10 @@
 - trigger informing about needed upgrade
 
 Revision 1.50  2004/11/05 07:37:12  luzik
- - updated to 1.3.2
+- updated to 1.3.2
 
 Revision 1.49  2004/10/14 07:16:28  luzik
- - updated to 3.1
+- updated to 3.1
 
 Revision 1.48  2004/10/13 13:49:29  blues
 - reorder install
@@ -425,24 +440,24 @@
 - typo
 
 Revision 1.40  2004/08/11 08:59:47  luzik
- - fixed %files
+- fixed %files
 
 Revision 1.39  2004/08/11 08:01:42  luzik
- - removed pl.pm source
+- removed pl.pm source
 
 Revision 1.38  2004/08/11 07:46:50  luzik
- - added logrotate files
- - added _noauto{req,prov} perl(Kernel::.*) macro
- - move some conf to /etc
- - added some examples files to %doc
- - rel. 0.2
+- added logrotate files
+- added _noauto{req,prov} perl(Kernel::.*) macro
+- move some conf to /etc
+- added some examples files to %doc
+- rel. 0.2
 
 Revision 1.37  2004/08/09 07:15:37  luzik
- - small fix
+- small fix
 
 Revision 1.36  2004/08/09 07:14:07  luzik
- - updated to 1.2.4
- - rel. 0.1
+- updated to 1.2.4
+- rel. 0.1
 
 Revision 1.35  2004/04/29 13:34:09  blues
 - next potion
@@ -470,8 +485,8 @@
 - reparated scripts package
 
 Revision 1.27  2004/03/26 11:14:57  luzik
- - added full pl translation
- - httpd restart in post
+- added full pl translation
+- httpd restart in post
 
 Revision 1.26  2004/03/18 10:14:48  blues
 - no fetchmail required
@@ -480,20 +495,20 @@
 - cosmetics
 
 Revision 1.24  2004/03/18 09:43:14  luzik
- - added PLD config
+- added PLD config
 
 Revision 1.23  2004/03/18 09:40:24  qboosh
 - one / is enough for otrsdir start
 
 Revision 1.22  2004/03/18 09:28:53  luzik
- - moved to /usr/share
+- moved to /usr/share
 
 Revision 1.21  2004/03/18 08:36:30  luzik
- - added httpd.conf include files
+- added httpd.conf include files
 
 Revision 1.20  2004/03/15 20:00:04  luzik
- - updated TODO
- - re. 0.2
+- updated TODO
+- re. 0.2
 
 Revision 1.19  2004/03/15 10:57:48  blues
 - typo
@@ -505,21 +520,21 @@
 - it's noarch
 
 Revision 1.16  2004/03/15 10:45:56  luzik
- - patch added
- - log fixed
+- patch added
+- log fixed
 
 Revision 1.15  2004/03/15 09:37:57  luzik
- - added bcond with apache1
- - clean
+- added bcond with apache1
+- clean
 
 Revision 1.14  2004/03/14 20:15:17  luzik
- - work, need clean
+- work, need clean
 
 Revision 1.13  2004/03/12 08:48:21  luzik
- - updated to 1.2.2, NFY
+- updated to 1.2.2, NFY
 
 Revision 1.12  2003/12/05 12:40:34  luzik
- - updated, clean
+- updated, clean
 
 Revision 1.11  2003/05/28 13:00:10  malekith
 - massive attack: source-md5
@@ -544,8 +559,8 @@
 
 Revision 1.4  2003/04/21 15:28:21  qboosh
 - shortened far too long description, added pl one
-- cleanups, missing dirs, fixed %%post script
-- added todo (put proper perms on files instead of modyfying in %%post)
+- cleanups, missing dirs, fixed %post script
+- added todo (put proper perms on files instead of modyfying in %post)
 
 Revision 1.3  2003/04/02 17:23:28  tjbynum
 - let us do something useful.
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/otrs.spec?r1=1.64&r2=1.65&f=u



More information about the pld-cvs-commit mailing list