forked from PearsonLTG/tomcat-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tomcat7.spec
181 lines (144 loc) · 5.41 KB
/
tomcat7.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
%define major_version 7
%define minor_version 0
%define micro_version 54
%define appname tomcat7
%define distname %{name}-%{version}
%define _topdir %(echo $PWD)/
%define basedir %{_datadir}/%{appname}
%define appdir %{basedir}/webapps
%define bindir %{_datadir}/%{appname}/bin
%define libdir %{_datadir}/%{appname}/lib
%define confdir %{_sysconfdir}/%{appname}
%define homedir %{_datadir}/%{appname}
%define logdir %{_var}/log/%{appname}
%define piddir %{_var}/run/%{appname}
%define cachedir %{_var}/cache/%{appname}
%define tempdir %{cachedir}/temp
%define workdir %{cachedir}/work
%define appuser tomcat
%define appuid 250
%define appgid 250
Name: tomcat7
Version: %{major_version}.%{minor_version}.%{micro_version}
Release: 1%{?dist}
Epoch: 0
Summary: Open source software implementation of the Java Servlet and JavaServer Pages technologies.
Group: Networking/Daemons
License: ASL 2.0
URL: http://tomcat.apache.org
Packager: Louis Garman <louisgarman@gmail.com>
Source0: http://www.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/bin/apache-tomcat-%{version}.tar.gz
Source1: tomcat.sysconfig
Source2: tomcat.init.sh
Source3: tomcat.logrotate.sh
Buildroot: %{_tmppath}/apache-tomcat-%{version}-%{release}-root
BuildArch: noarch
%description
Tomcat is the servlet container that is used in the official Reference
Implementation for the Java Servlet and JavaServer Pages technologies.
The Java Servlet and JavaServer Pages specifications are developed by
Sun under the Java Community Process.
%package manager
Summary: The management web application of Apache Tomcat.
Group: System Environment/Applications
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description manager
The management web application of Apache Tomcat.
%package host-manager
Summary: The host-management web application of Apache Tomcat.
Group: System Environment/Applications
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description host-manager
The host-management web application of Apache Tomcat.
%prep
%setup -n apache-tomcat-%{version} -q -b 0 -T
%build
%install
rm -rf %{buildroot}
%{__install} -d -m 0755 %{buildroot}%{_bindir}
%{__install} -d -m 0755 %{buildroot}%{_sbindir}
%{__install} -d -m 0755 %{buildroot}%{_initrddir}
%{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig
%{__install} -d -m 0775 %{buildroot}%{appdir}
%{__install} -d -m 0755 %{buildroot}%{bindir}
%{__install} -d -m 0755 %{buildroot}%{libdir}
%{__install} -d -m 0755 %{buildroot}%{confdir}
%{__install} -d -m 0775 %{buildroot}%{confdir}/Catalina/localhost
%{__install} -d -m 0775 %{buildroot}%{logdir}
%{__install} -d -m 0775 %{buildroot}%{piddir}
%{__install} -d -m 0775 %{buildroot}%{homedir}
%{__install} -d -m 0775 %{buildroot}%{tempdir}
%{__install} -d -m 0775 %{buildroot}%{workdir}
pushd %{buildroot}/%{homedir}
%{__ln_s} %{confdir} conf
%{__ln_s} %{logdir} logs
%{__ln_s} %{tempdir} temp
%{__ln_s} %{workdir} work
popd
%{__install} -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{appname}
%{__install} -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/%{appname}
%{__install} -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{appname}
%{__cp} -a bin/*.{jar,xml} %{buildroot}%{bindir}
%{__cp} -a bin/*.sh %{buildroot}%{bindir}
%{__cp} -a conf/*.{policy,properties,xml} %{buildroot}%{confdir}
%{__cp} -a lib/*.jar %{buildroot}%{libdir}
%{__cp} -a webapps/{ROOT,manager,host-manager} %{buildroot}%{appdir}
%clean
%{__rm} -rf %{buildroot}
%pre
%{_sbindir}/groupadd -g %{appgid} -r %{appuser} 2>/dev/null || :
%{_sbindir}/useradd -c "Apache Tomcat" -u %{appuid} -g %{appuser} -s /bin/sh -r -d %{homedir} %{appuser} 2>/dev/null || :
%post
/sbin/chkconfig --add %{appname}
%preun
%{__rm} -rf %{workdir}/* %{tempdir}/*
if [ "$1" = "0" ]; then
%{_initrddir}/%{appname} stop >/dev/null 2>&1
/sbin/chkconfig --del %{appname}
fi
# RPM 4.8 has a bug in defattr() with dir mode
%files
#%defattr(0644 root root 0755)
%doc ./{LICENSE,NOTICE,RELEASE*}
%attr(0775 tomcat tomcat) %dir %{logdir}
%attr(0775 tomcat tomcat) %dir %{piddir}
%attr(0755 root root) %{_initrddir}/%{appname}
%attr(0644 root root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{appname}
%config(noreplace) %{_sysconfdir}/sysconfig/%{appname}
%dir %{basedir}
%{basedir}/conf
%{basedir}/logs
%{basedir}/temp
%{basedir}/work
%attr(0775 tomcat tomcat) %dir %{appdir}
%{appdir}/ROOT
%dir %{confdir}
%dir %{confdir}/Catalina
%attr(0775 root root) %dir %{confdir}/Catalina/localhost
%config(noreplace) %{confdir}/*.policy
%config(noreplace) %{confdir}/*.properties
%config(noreplace) %{confdir}/context.xml
%config(noreplace) %{confdir}/server.xml
%attr(0660 tomcat tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
%config(noreplace) %{confdir}/web.xml
%attr(0775 tomcat tomcat) %dir %{cachedir}
%attr(0775 tomcat tomcat) %dir %{tempdir}
%attr(0775 tomcat tomcat) %dir %{workdir}
%attr(- tomcat tomcat) %{homedir}
%files manager
%defattr(0644 tomcat tomcat 0755)
%{appdir}/manager
%files host-manager
%defattr(0644 tomcat tomcat 0755)
%{appdir}/host-manager
%changelog
* Sun Sep 01 2013 Louis Garman <louisgarman@gmail.com> - 7.0.42
- Renamed from apache-tomcat to tomcat7
- Moved webapps dir from /var/lib to /usr/share (as per the tomcat6 rpm)
* Fri Nov 30 2012 Joseph Lamoree <jlamoree@ecivis.com> - 7.0.33-1%{?dist}
- First packaging of Apache Tomcat for eCivis apps
- TODO Tomcat native connector
- TODO Support for multiple instances