source: raptor-distribution/RPMs/raptor-ica/tags/v1.2.1-1/raptor-ica-1.2.1-1.spec @ 1607

Revision 1607, 6.1 KB checked in by rhyssmith, 5 years ago (diff)

Tagging v1.2.1-1 release of Raptor ICA RPM

Line 
1%define __jar_repack %{nil}
2
3Name:          raptor-ica
4Version:       1.2.1
5Release:       1
6Summary:       Information Collector Agent component of the Raptor Software Suite
7Group:         Productivity/Other
8License:       Apache 2.0
9URL:           http://iam.cf.ac.uk/Raptor
10Source:        %{name}-%{version}.zip
11BuildArch:     noarch
12BuildRoot:     %{_tmppath}/%{name}-%{version}-build
13
14BuildRequires: unzip
15Requires:      java >= 1.6.0
16
17
18
19%description
20Raptor is a software tool designed to report upon authentication
21information for access management systems such as the Shibboleth IdP
22and EZproxy. The ICA is the agent that resides alongside the system
23to be monitored and analyses its log files for authentication events.
24The ICA will then send this information to an MUA (raptor-mua) instance.
25
26
27
28%prep
29
30# Remove anything that already exists, unzip source, and cd into it
31%{__rm} -rf %{name}-%{version}
32%{__unzip} -q %{_sourcedir}/%{name}-%{version}.zip
33cd %{name}-%{version}
34
35
36 
37%build
38# Nothing to do
39
40
41 
42%install
43
44# Suppress the java 1.5 bytecode verion error when compiling for SLE on the OSBS
45export NO_BRP_CHECK_BYTECODE_VERSION=true
46
47# Create fixed-location directories in /opt
48install -d %{buildroot}/opt/raptor/ica/conf
49install -d %{buildroot}/opt/raptor/ica/keys
50install -d %{buildroot}/opt/raptor/ica/lib
51install -d %{buildroot}/opt/raptor/ica/logs
52
53# Create directory for the initscript
54%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
55    install -d -m 0755 %{buildroot}%{_initrddir}
56%if "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
57    install -d -m 0755 %{buildroot}/%{_sbindir}
58%endif
59%endif
60
61# Create directory for logrotate config
62install -d %{buildroot}/etc/logrotate.d
63
64
65# Install fixed-location files to correct locations
66cp -r %{_builddir}/%{name}-%{version}/conf/* %{buildroot}/opt/raptor/ica/conf
67cp -r %{_builddir}/%{name}-%{version}/keys/* %{buildroot}/opt/raptor/ica/keys
68cp -r %{_builddir}/%{name}-%{version}/lib/* %{buildroot}/opt/raptor/ica/lib
69cp -r %{_builddir}/%{name}-%{version}/%{name}.jar %{buildroot}/opt/raptor/ica
70
71# Install initscript
72%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
73    install -m 0755 %{_builddir}/%{name}-%{version}/bin/raptoricad %{buildroot}%{_initrddir}/raptoricad
74%if "%{_vendor}" == "suse"  || "%{_vendor}" == "Mandriva"
75    %{__ln_s} -f %{_initrddir}/raptoricad %{buildroot}%{_sbindir}/rcraptoricad
76%endif
77%endif
78
79# Install logrotate config
80cp -r %{_builddir}/%{name}-%{version}/misc/logrotate-raptorica.conf %{buildroot}/etc/logrotate.d/raptorica
81
82
83
84 
85%clean
86
87# Remove everything in the buildroot
88[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
89
90 
91 
92%post
93
94# Once the RPM is installed, key generation for this ICA instance should take place
95# But only if installing, not ugprading!
96if [ $1 == 1 ] ; then
97    host=`hostname -f`
98   
99    # Only run these commands if keytool exists
100    if command -v keytool > /dev/null; then
101        keytool -genkey -alias raptorica -keystore /opt/raptor/ica/keys/raptor-ica.jks -storepass changeit -keypass changeit -dname "CN=$host,ou=ICA,o=Raptor" -validity 7300 -keyalg RSA -keysize 2048
102        keytool -export -alias raptorica -keystore /opt/raptor/ica/keys/raptor-ica.jks -storepass changeit -file /opt/raptor/ica/keys/raptor-ica-public.crt
103    else
104        echo ERROR: keytool command not found - automatic key generation for the Raptor ICA has not taken place and must be performed manually!
105    fi
106fi
107 
108# And then we want to add the service's initscript
109%if "%{_vendor}" == "redhat" || "%{_vendor}" == "Mandriva"
110    # Add the service to the usual runlevels
111    /sbin/chkconfig --add raptoricad
112   
113    # If upgrading, restart if the daemon is already running
114    if [ $1 -gt 1 ] ; then
115        /etc/init.d/raptoricad status 1>/dev/null && /etc/init.d/raptoricad restart 1>/dev/null
116        exit 0
117    fi
118%endif
119%if "%{_vendor}" == "suse"
120    # Add the service to the usual runlevels
121    cd /
122    %insserv_force_if_yast raptoricad
123%endif
124
125 
126%preun
127
128# Stop the service before uninstalling
129%if "%{_vendor}" == "redhat" || "%{_vendor}" == "Mandriva"
130    if [ $1 == 0 ] ; then
131        /sbin/service raptoricad stop >/dev/null 2>&1
132        /sbin/chkconfig --del raptoricad
133    fi
134%endif
135%if "%{_vendor}" == "suse"
136    %stop_on_removal raptoricad
137%endif
138exit 0
139
140 
141%postun
142
143 
144%files
145
146%defattr(-,root,root,-)
147
148%dir /opt/raptor
149%dir /opt/raptor/ica
150%dir /opt/raptor/ica/conf
151%dir /opt/raptor/ica/keys
152%dir /opt/raptor/ica/lib
153%dir /opt/raptor/ica/logs
154
155%config(noreplace) /opt/raptor/ica/conf/event-parse.xml
156%config(noreplace) /opt/raptor/ica/conf/event-parse-formats-custom.xml
157%config            /opt/raptor/ica/conf/event-parse-formats-system.xml
158%config(noreplace) /opt/raptor/ica/conf/event-release.xml
159%config            /opt/raptor/ica/conf/ica-core.xml
160%config(noreplace) /opt/raptor/ica/conf/logging.xml
161%config(noreplace) /opt/raptor/ica/conf/metadata.xml
162%config(noreplace) /opt/raptor/ica/conf/server.properties
163%config(noreplace) /opt/raptor/ica/keys/authorised-keys.jks
164
165/opt/raptor/ica/lib/*.jar
166/opt/raptor/ica/%{name}.jar
167
168%config            /etc/logrotate.d/raptorica
169
170%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
171    %config %{_initrddir}/raptoricad
172%endif
173%if "%{_vendor}" == "suse"
174    %config %{_sbindir}/rcraptoricad
175%endif
176
177
178%changelog
179* Tue Feb 25 2014  Rhys Smith <smith@cardiff.ac.uk>  1.2.1-1
180- Some bugfixes for the (unreleased) v1.2.0. See release notes for details.
181
182* Mon Jul 8 2013  Rhys Smith <smith@cardiff.ac.uk>  1.2.0-1
183- First release of v1.2. See release notes for details.
184
185* Fri Aug 24 2012  Rhys Smith <smith@cardiff.ac.uk>  1.1.2-1
186- Bugfix to v1.1.0. See release notes for details.
187
188* Fri Jul 6 2012  Rhys Smith <smith@cardiff.ac.uk>  1.1.0-1
189- First release of v1.1. See release notes for details.
190
191* Mon Dec 19 2011  Rhys Smith <smith@cardiff.ac.uk>  1.0.1-1
192- Minor bugfix to v1.0.0 - modified initscript only.
193
194* Mon Dec 05 2011  Rhys Smith <smith@cardiff.ac.uk>  1.0.0-1
195- First release of v1. Some changed config files.
196
197* Sat Sep 17 2011  Rhys Smith <smith@cardiff.ac.uk>  0.2.0-1
198- Bumping version for v0.2.0 release.
199
200* Mon May 16 2011  Rhys Smith <smith@cardiff.ac.uk>  0.1.0-1
201- First version.
Note: See TracBrowser for help on using the repository browser.