SPECS: uebimiau.spec - use webapps framework

glen glen at pld-linux.org
Sat Dec 3 22:31:59 CET 2005


Author: glen                         Date: Sat Dec  3 21:31:59 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- use webapps framework

---- Files affected:
SPECS:
   uebimiau.spec (1.43 -> 1.44) 

---- Diffs:

================================================================
Index: SPECS/uebimiau.spec
diff -u SPECS/uebimiau.spec:1.43 SPECS/uebimiau.spec:1.44
--- SPECS/uebimiau.spec:1.43	Wed Oct 26 17:23:47 2005
+++ SPECS/uebimiau.spec	Sat Dec  3 22:31:53 2005
@@ -4,7 +4,7 @@
 Name:		uebimiau
 Version:	2.7.8
 %define		_rc	RC1
-%define		_rel 4.3
+%define		_rel 4.5
 Release:	9.%{_rc}.%{_rel}
 License:	GPL
 Group:		Applications/Mail
@@ -17,12 +17,12 @@
 Patch4:		%{name}-focus.patch
 URL:		http://www.uebimiau.org/
 BuildRequires:	sed >= 4.1.1
-BuildRequires:	rpmbuild(macros) >= 1.226
+BuildRequires:	rpmbuild(macros) >= 1.264
 # BR: rpm - not for Ra where is wrong def. of %%{_sharedstatedir}.
 BuildRequires:	rpm >= 4.3
 Requires:	Smarty >= 2.6.10-3
 Requires:	sed >= 4.1.1
-Requires:	webserver
+Requires:	webapps
 Provides:	webmail
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -30,6 +30,9 @@
 %define		_appdir		%{_datadir}/%{name}
 %define		_smartydir	%{_datadir}/php/Smarty
 %define		_sysconfdir	/etc/%{name}
+%define		_webapps	/etc/webapps
+%define		_webapp		%{name}
+%define		_sysconfdir	%{_webapps}/%{_webapp}
 
 %description
 UebiMiau is a web-based e-mail client written in PHP. It has some
@@ -52,17 +55,18 @@
 # undos the source
 find . -name '*.php' -print0 | xargs -0 sed -i -e 's,\r$,,'
 
-%install
-rm -rf $RPM_BUILD_ROOT
-
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sharedstatedir}/%{name}}
-install -d $RPM_BUILD_ROOT%{_appdir}/{database,extra,images,inc,langs,themes/default}
+echo 'Alias /%{name} %{_appdir}' > apache.conf
 
 %{__sed} -i "s|\$temporary_directory = \"./database/\";|\$temporary_directory = \"%{_sharedstatedir}/%{name}/\";|" inc/config.php
 for f in index.php badlogin.php error.php inc/inc.php; do
 	%{__sed} -i "s|define(\"SMARTY_DIR\",\"./smarty/\");|define(\"SMARTY_DIR\",\"%{_smartydir}/\");|" $f
 done
 
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sharedstatedir}/%{name}}
+install -d $RPM_BUILD_ROOT%{_appdir}/{database,extra,images,inc,langs,themes/default}
+
 install *.php			$RPM_BUILD_ROOT%{_appdir}
 install database/index.php	$RPM_BUILD_ROOT%{_appdir}/database
 install extra/*			$RPM_BUILD_ROOT%{_appdir}/extra
@@ -71,7 +75,8 @@
 install langs/*			$RPM_BUILD_ROOT%{_appdir}/langs
 install themes/debug.tpl	$RPM_BUILD_ROOT%{_appdir}/themes
 install themes/default/*	$RPM_BUILD_ROOT%{_appdir}/themes/default
-echo "Alias /%{name} %{_appdir}" > $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+install apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+install apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
 
 mv $RPM_BUILD_ROOT%{_appdir}/inc/config{,.languages,.security}.php	$RPM_BUILD_ROOT%{_sysconfdir}
 ln -s %{_sysconfdir}/config.php		$RPM_BUILD_ROOT%{_appdir}/inc/config.php
@@ -81,42 +86,17 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post
-if [ -f %{_sysconfdir}/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" %{_sysconfdir}/httpd/httpd.conf; then
-	echo "Include %{_sysconfdir}/httpd/%{name}.conf" >> %{_sysconfdir}/httpd/httpd.conf
-elif [ -d %{_sysconfdir}/httpd/httpd.conf ]; then
-	ln -sf %{_sysconfdir}/httpd/%{name}.conf %{_sysconfdir}/httpd/httpd.conf/99_%{name}.conf
-fi
-if [ -f /var/lock/subsys/httpd ]; then
-	%{_sbindir}/apachectl restart 1>&2
-fi
-
-%preun
-if [ "$1" = "0" ]; then
-	umask 027
-	if [ -d %{_sysconfdir}/httpd/httpd.conf ]; then
-		rm -f %{_sysconfdir}/httpd/httpd.conf/99_%{name}.conf
-	else
-		grep -v "^Include.*%{name}.conf" %{_sysconfdir}/httpd/httpd.conf > \
-			%{_sysconfdir}/httpd/httpd.conf.tmp
-		mv -f %{_sysconfdir}/httpd/httpd.conf.tmp %{_sysconfdir}/httpd/httpd.conf
-		if [ -f /var/lock/subsys/httpd ]; then
-			%{_sbindir}/apachectl restart 1>&2
-		fi
-	fi
-fi
+%triggerin -- apache1
+%webapp_register apache %{_webapp}
 
-%triggerin -- apache1 >= 1.3.33-2
-%apache_config_install -v 1 -c %{_sysconfdir}/apache.conf
-
-%triggerun -- apache1 >= 1.3.33-2
-%apache_config_uninstall -v 1
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
 
 %triggerin -- apache >= 2.0.0
-%apache_config_install -v 2 -c %{_sysconfdir}/apache.conf
+%webapp_register httpd %{_webapp}
 
 %triggerun -- apache >= 2.0.0
-%apache_config_uninstall -v 2
+%webapp_unregister httpd %{_webapp}
 
 %triggerun -- %{name} < 2.7.8-5.RC1
 RADIR=/home/httpd/html/uebimiau/inc
@@ -163,45 +143,71 @@
 	fi
 fi
 
-%triggerpostun -- uebimiau < 2.7.8-8.RC1.4.1
-# migrate from old config location (only apache2, as there was no apache1 support)
-if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
-	cp -f %{_sysconfdir}/apache.conf{,.rpmnew}
-	mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/apache.conf
-	if [ -f /var/lock/subsys/httpd ]; then
-		/etc/rc.d/init.d/httpd reload 1>&2
+%triggerpostun -- %{name} < 2.7.8-9.RC1.4.5
+# rescue app config
+for i in config.languages.php config.php config.security.php; do
+	if [ -f /etc/%{name}/$i.rpmsave ]; then
+		mv -f %{_sysconfdir}/$i{,.rpmnew}
+		mv -f /etc/%{name}/$i.rpmsave %{_sysconfdir}/$i
 	fi
-fi
+done
 
 # nuke very-old config location (this mostly for Ra)
-if [ ! -d /etc/httpd/httpd.conf ]; then
+if [ -f /etc/httpd/httpd.conf ]; then
 	sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
-	if [ -f /var/lock/subsys/httpd ]; then
-		/etc/rc.d/init.d/httpd reload 1>&2
+	httpd_reload=1
+fi
+
+# migrate from httpd (apache2) config dir
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+	cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
+	mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/httpd.conf
+	httpd_reload=1
+fi
+
+# migrate from apache-config macros
+if [ -f /etc/%{name}/apache.conf.rpmsave ]; then
+	if [ -d /etc/apache/webapps.d ]; then
+		cp -f %{_sysconfdir}/apache.conf{,.rpmnew}
+		cp -f /etc/%{name}/apache.conf.rpmsave %{_sysconfdir}/apache.conf
+	fi
+
+	if [ -d /etc/httpd/webapps.d ]; then
+		cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
+		cp -f /etc/%{name}/apache.conf.rpmsave %{_sysconfdir}/httpd.conf
 	fi
+	rm -f /etc/%{name}/apache.conf.rpmsave
 fi
 
 # place new config location, as trigger puts config only on first install, do it here.
-# apache1
-if [ -d /etc/apache/conf.d ]; then
-	ln -sf %{_sysconfdir}/apache.conf /etc/apache/conf.d/99_%{name}.conf
-	if [ -f /var/lock/subsys/apache ]; then
-		/etc/rc.d/init.d/apache reload 1>&2
-	fi
+if [ -L /etc/apache/conf.d/99_%{name}.conf ]; then
+	rm -f /etc/apache/conf.d/99_%{name}.conf
+	/usr/sbin/webapp register apache %{_webapp}
+	apache_reload=1
 fi
-# apache2
-if [ -d /etc/httpd/httpd.conf ]; then
-	ln -sf %{_sysconfdir}/apache.conf /etc/httpd/httpd.conf/99_%{name}.conf
+if [ -L /etc/httpd/httpd.conf/99_%{name}.conf ]; then
+	rm -f /etc/httpd/httpd.conf/99_%{name}.conf
+	/usr/sbin/webapp register httpd %{_webapp}
+	httpd_reload=1
+fi
+
+if [ "$httpd_reload" ]; then
 	if [ -f /var/lock/subsys/httpd ]; then
 		/etc/rc.d/init.d/httpd reload 1>&2
 	fi
 fi
+if [ "$apache_reload" ]; then
+	if [ -f /var/lock/subsys/apache ]; then
+		/etc/rc.d/init.d/apache reload 1>&2
+	fi
+fi
 
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG.txt INSTALL.txt README.txt
 %attr(750,root,http) %dir %{_sysconfdir}
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.php
 
 %dir %{_appdir}
@@ -223,6 +229,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.44  2005/12/03 21:31:53  glen
+- use webapps framework
+
 Revision 1.43  2005/10/26 15:23:47  glen
 - apache config triggers, other work
 
@@ -266,7 +275,7 @@
 - removed attachment,readmsg.patch (included in bugfixes.patch)
 - added bugfixes.patch (fix download,attachment,redir,moving bugs)
 - dropped out Source0-size
-- release 8 ; STBR
+- release 8; STBR
 
 Revision 1.31  2004/11/15 17:12:15  kosmo
 - added folders patch, rel++
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/uebimiau.spec?r1=1.43&r2=1.44&f=u




More information about the pld-cvs-commit mailing list