]>
Commit | Line | Data |
---|---|---|
1 | Summary: Package that uses webapps configuration | |
2 | Summary(pl.UTF-8): Pakiet używający konfiguracji aplikacji WWW | |
3 | Name: template-webapp | |
4 | Version: 0.3 | |
5 | Release: 0.3 | |
6 | License: GPL | |
7 | Group: Applications/WWW | |
8 | #Source0: %{name}-%{version}.tar.gz | |
9 | # Source0-md5: - | |
10 | #Source1: apache.conf | |
11 | #Source2: lighttpd.conf | |
12 | #URL: - | |
13 | BuildRequires: rpmbuild(macros) >= 1.268 | |
14 | Requires: webapps | |
15 | # see packages/webapps/webapps.README for description and complete listing | |
16 | #Requires: webserver(access) | |
17 | #Requires: webserver(alias) | |
18 | #Requires: webserver(auth) | |
19 | #Requires: webserver(cgi) | |
20 | #Requires: webserver(expires) | |
21 | #Requires: webserver(indexfile) | |
22 | #Requires: webserver(mime) | |
23 | #Requires: webserver(php) | |
24 | #Requires: webserver(setenv) | |
25 | BuildArch: noarch | |
26 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
27 | ||
28 | %define _webapps /etc/webapps | |
29 | %define _webapp %{name} | |
30 | %define _sysconfdir %{_webapps}/%{_webapp} | |
31 | #%define _appdir %{_datadir}/%{_webapp} | |
32 | ||
33 | # in case _sysconfdir is not in webapps dir, run this replace pattern | |
34 | # before copy-pasting to your spec: :%s#%{_sysconfdir}#%{_webapps}/%{_webapp}#g | |
35 | ||
36 | %description | |
37 | This .spec is for demonstrating triggers used for linking webapp | |
38 | configuration to webserver config dir. | |
39 | ||
40 | %description -l pl.UTF-8 | |
41 | Ten plik .spec służy do pokazania triggerów służących do podłączania | |
42 | konfiguracji aplikacji WWW do katalogu konfiguracyjnego serwera WWW. | |
43 | ||
44 | %prep | |
45 | %setup -q | |
46 | ||
47 | cat > apache.conf <<'EOF' | |
48 | Alias /%{name} %{_appdir} | |
49 | <Directory %{_appdir}> | |
50 | # Apache 2.x | |
51 | <IfModule !mod_authz_core.c> | |
52 | Order allow,deny | |
53 | Allow from all | |
54 | </IfModule> | |
55 | # Apache 2.4 | |
56 | <IfModule mod_authz_core.c> | |
57 | Require all granted | |
58 | </IfModule> | |
59 | </Directory> | |
60 | EOF | |
61 | ||
62 | cat > lighttpd.conf <<'EOF' | |
63 | alias.url += ( | |
64 | "/%{name}" => "%{_appdir}", | |
65 | ) | |
66 | EOF | |
67 | ||
68 | %install | |
69 | rm -rf $RPM_BUILD_ROOT | |
70 | install -d $RPM_BUILD_ROOT%{_sysconfdir} | |
71 | install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_appdir}} | |
72 | ||
73 | cp -a . $RPM_BUILD_ROOT%{_appdir} | |
74 | ||
75 | cp -p apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf | |
76 | cp -p apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
77 | cp -p lighttpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
78 | ||
79 | mv $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir}}/apache.conf | |
80 | mv $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir}}/lighttpd.conf | |
81 | cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf | |
82 | ||
83 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf | |
84 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
85 | cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf | |
86 | ||
87 | %clean | |
88 | rm -rf $RPM_BUILD_ROOT | |
89 | ||
90 | # %webapp_* macros usage extracted from /usr/lib/rpm/macros.build: | |
91 | # | |
92 | # Usage: | |
93 | # %%webapp_register HTTPD WEBAPP | |
94 | # %%webapp_unregister HTTPD WEBAPP | |
95 | ||
96 | %triggerin -- apache1 < 1.3.37-3, apache1-base | |
97 | %webapp_register apache %{_webapp} | |
98 | ||
99 | %triggerun -- apache1 < 1.3.37-3, apache1-base | |
100 | %webapp_unregister apache %{_webapp} | |
101 | ||
102 | %triggerin -- apache < 2.2.0, apache-base | |
103 | %webapp_register httpd %{_webapp} | |
104 | ||
105 | %triggerun -- apache < 2.2.0, apache-base | |
106 | %webapp_unregister httpd %{_webapp} | |
107 | ||
108 | %triggerin -- lighttpd | |
109 | %webapp_register lighttpd %{_webapp} | |
110 | ||
111 | %triggerun -- lighttpd | |
112 | %webapp_unregister lighttpd %{_webapp} | |
113 | ||
114 | %files | |
115 | %defattr(644,root,root,755) | |
116 | %dir %attr(750,root,http) %{_sysconfdir} | |
117 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
118 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
119 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf | |
120 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.php | |
121 | %{_appdir} |