source: raptor-distribution/RPMs/raptor-ica/tags/v0.2.0-1/raptor-ica-0.2.0-1.spec @ 1595

Revision 1595, 5.0 KB checked in by rhyssmith, 5 years ago (diff)

Tagging v0.2.0-1 release of Raptor ICA RPM

Line 
1%define __jar_repack %{nil}
2
3Name:          raptor-ica
4Version:       0.2.0
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# Install fixed-location files to correct locations
62cp -r %{_builddir}/%{name}-%{version}/conf/* %{buildroot}/opt/raptor/ica/conf
63cp -r %{_builddir}/%{name}-%{version}/keys/* %{buildroot}/opt/raptor/ica/keys
64cp -r %{_builddir}/%{name}-%{version}/lib/* %{buildroot}/opt/raptor/ica/lib
65cp -r %{_builddir}/%{name}-%{version}/%{name}.jar %{buildroot}/opt/raptor/ica
66
67# Install initscript
68%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
69    install -m 0755 %{_builddir}/%{name}-%{version}/bin/raptoricad %{buildroot}%{_initrddir}/raptoricad
70%if "%{_vendor}" == "suse"  || "%{_vendor}" == "Mandriva"
71    %{__ln_s} -f %{_initrddir}/raptoricad %{buildroot}%{_sbindir}/rcraptoricad
72%endif
73%endif
74
75
76 
77%clean
78
79# Remove everything in the buildroot
80[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
81
82 
83 
84%post
85
86# Once the RPM is installed, key generation for this ICA instance should take place
87# But only if installing, not ugprading!
88if [ $1 == 1 ] ; then
89    host=`hostname -f`
90   
91    # Only run these commands if keytool exists
92    if command -v keytool > /dev/null; then
93        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
94        keytool -export -alias raptorica -keystore /opt/raptor/ica/keys/raptor-ica.jks -storepass changeit -file /opt/raptor/ica/keys/raptor-ica-public.crt
95    else
96        echo ERROR: keytool command not found - automatic key generation for the Raptor ICA has not taken place and must be performed manually!
97    fi
98fi
99 
100# And then we want to add the service's initscript
101%if "%{_vendor}" == "redhat" || "%{_vendor}" == "Mandriva"
102    # Add the service to the usual runlevels
103    /sbin/chkconfig --add raptoricad
104   
105    # If upgrading, restart if the daemon is already running
106    if [ $1 -gt 1 ] ; then
107        /etc/init.d/raptoricad status 1>/dev/null && /etc/init.d/raptoricad restart 1>/dev/null
108        exit 0
109    fi
110%endif
111%if "%{_vendor}" == "suse"
112    # Add the service to the usual runlevels
113    cd /
114    %insserv_force_if_yast raptoricad
115%endif
116
117 
118%preun
119
120# Stop the service before uninstalling
121%if "%{_vendor}" == "redhat" || "%{_vendor}" == "Mandriva"
122    if [ $1 == 0 ] ; then
123        /sbin/service raptoricad stop >/dev/null 2>&1
124        /sbin/chkconfig --del raptoricad
125    fi
126%endif
127%if "%{_vendor}" == "suse"
128    %stop_on_removal raptoricad
129%endif
130exit 0
131
132 
133%postun
134
135 
136%files
137%defattr(-,root,root,-)
138%dir /opt/raptor
139%dir /opt/raptor/ica
140%dir /opt/raptor/ica/conf
141%dir /opt/raptor/ica/keys
142%dir /opt/raptor/ica/lib
143%dir /opt/raptor/ica/logs
144%config(noreplace) /opt/raptor/ica/conf/event-release.xml
145%config(noreplace) /opt/raptor/ica/conf/logging.xml
146%config(noreplace) /opt/raptor/ica/conf/metadata.xml
147%config(noreplace) /opt/raptor/ica/conf/server.properties
148%config /opt/raptor/ica/conf/event-parse.xml
149%config /opt/raptor/ica/conf/ica-core.xml
150%config(noreplace) /opt/raptor/ica/keys/authorised-keys.jks
151/opt/raptor/ica/lib/*.jar
152/opt/raptor/ica/%{name}.jar
153%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
154    %config %{_initrddir}/raptoricad
155%endif
156%if "%{_vendor}" == "suse"
157    %config %{_sbindir}/rcraptoricad
158%endif
159
160%changelog
161* Sat Sep 17 2011  Rhys Smith <smith@cardiff.ac.uk>  0.2.0-1
162- Bumping version for v0.2.0 release.
163
164* Mon May 16 2011  Rhys Smith <smith@cardiff.ac.uk>  0.1.0-1
165- First version.
Note: See TracBrowser for help on using the repository browser.