]> git.pld-linux.org Git - projects/template-specs.git/blob - webapp.spec
- updated pl
[projects/template-specs.git] / webapp.spec
1 Summary:        Package that uses webapps configuration
2 Summary(pl):    Pakiet u¿ywaj±cy konfiguracji aplikacji WWW
3 Name:           template-webapp
4 Version:        0.2
5 Release:        0.7
6 License:        GPL
7 Group:          Development
8 BuildRequires:  rpmbuild(macros) >= 1.264
9 Requires:       webapps
10 %if %{with trigger}
11 Requires(triggerpostun):        sed >= 4.0
12 %endif
13 BuildArch:      noarch
14 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
15
16 %define         _webapps        /etc/webapps
17 %define         _webapp         sample-webapp
18 %define         _sysconfdir     %{_webapps}/%{_webapp}
19
20 %description
21 This .spec is for demonstrating triggers used for linking webapp
22 configuration to webserver config dir.
23
24 %description -l pl
25 Ten plik .spec s³u¿y do pokazania triggerów s³u¿±cych do pod³±czania
26 konfiguracji aplikacji WWW do katalogu konfiguracyjnego serwera WWW.
27
28 %prep
29 cat > config.conf <<EOF
30 # This is sample config
31 EOF
32
33 %install
34 rm -rf $RPM_BUILD_ROOT
35 install -d $RPM_BUILD_ROOT%{_sysconfdir}
36
37 #install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
38 install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
39 install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
40 install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
41
42 # %webapp_* macros usage extracted from /usr/lib/rpm/macros.build:
43 #
44 # Usage:
45 #   %%webapp_register HTTPD WEBAPP
46 #   %%webapp_unregister HTTPD WEBAPP
47
48 %triggerin -- apache1
49 %webapp_register apache %{_webapp}
50
51 %triggerun -- apache1
52 %webapp_unregister apache %{_webapp}
53
54 %triggerin -- apache >= 2.0.0
55 %webapp_register httpd %{_webapp}
56
57 %triggerun -- apache >= 2.0.0
58 %webapp_unregister httpd %{_webapp}
59
60 %triggerin -- lighttpd
61 %webapp_register lighttpd %{_webapp}
62
63 %triggerun -- lighttpd
64 %webapp_unregister lighttpd %{_webapp}
65
66 %if 00000000000000000000000000000000000
67 # SAMPLE TRIGGER FOR MIGRATION PURPOSES
68 %triggerpostun -- %{name} < 1.3.9-1.4
69 # migrate from apache-config macros
70 if [ -f /etc/%{name}/apache.conf.rpmsave ]; then
71         if [ -d /etc/apache/webapps.d ]; then
72                 cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
73                 cp -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
74         fi
75
76         if [ -d /etc/httpd/webapps.d ]; then
77                 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
78                 cp -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
79         fi
80 fi
81 # same but without separate %{_sysconfdir} for package
82 if [ -f /etc/apache-%{name}.conf.rpmsave ]; then
83         if [ -d /etc/apache/webapps.d ]; then
84                 cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
85                 cp -f /etc/apache-%{name}.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
86         fi
87
88         if [ -d /etc/httpd/webapps.d ]; then
89                 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
90                 cp -f /etc/apache-%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
91         fi
92 fi
93
94 # migrate from httpd (apache2) config dir
95 if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
96         cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
97         cp -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
98         httpd_reload=1
99 fi
100
101 # nuke very-old config location (this mostly for Ra)
102 if [ -f /etc/httpd/httpd.conf ]; then
103         sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
104         httpd_reload=1
105 fi
106
107 # place new config location, as trigger puts config only on first install, do it here.
108 # apache1
109 if [ -d /etc/apache/webapps.d ]; then
110         /usr/sbin/webapp register apache %{_webapp}
111         apache_reload=1
112 fi
113 # apache2
114 if [ -d /etc/httpd/webapps.d ]; then
115         /usr/sbin/webapp register httpd %{_webapp}
116         httpd_reload=1
117 fi
118
119 if [ "$httpd_reload" ]; the
120         if [ -f /var/lock/subsys/httpd ]; then
121                 /etc/rc.d/init.d/httpd reload 1>&2
122         fi
123 fi
124 if [ "$apache_reload" ]; the
125         if [ -f /var/lock/subsys/apache ]; then
126                 /etc/rc.d/init.d/apache reload 1>&2
127         fi
128 fi
129 %endif # END OF SAMPLE TRIGGER
130
131 %clean
132 rm -rf $RPM_BUILD_ROOT
133
134 %files
135 %defattr(644,root,root,755)
136 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
137 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
138 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
139 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
140
141 #%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/*.php
This page took 0.076792 seconds and 4 git commands to generate.