source: raptor-distribution/RPMs/raptor-web/trunk/raptor-web-0.1.1-1.spec @ 1636

Revision 1636, 5.1 KB checked in by rhyssmith, 5 years ago (diff)

Adding raptor-web v0.1.1 RPM sources

Line 
1%define __jar_repack %{nil}
2
3Name:          raptor-web
4Version:       0.1.1
5Release:       1
6Summary:       Web interface 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 Web interface is the service that connect to an MUA
23(raptor-mia) instance, allowing users to view and query its data.
24
25
26%prep
27
28# Remove anything that already exists, unzip source, and cd into it
29%{__rm} -rf %{name}-%{version}
30%{__unzip} -q %{_sourcedir}/%{name}-%{version}.zip
31cd %{name}-%{version}
32
33
34 
35%build
36# Nothing to do
37
38
39 
40%install
41
42# Suppress the java 1.5 bytecode verion error when compiling for SLE on the OSBS
43export NO_BRP_CHECK_BYTECODE_VERSION=true
44
45# Create fixed-location directories in /opt
46install -d %{buildroot}/opt/raptor/web/conf
47install -d %{buildroot}/opt/raptor/web/keys
48install -d %{buildroot}/opt/raptor/web/lib
49install -d %{buildroot}/opt/raptor/web/logs
50install -d %{buildroot}/opt/raptor/web/webapp
51
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/web/conf
63cp -r %{_builddir}/%{name}-%{version}/keys/* %{buildroot}/opt/raptor/web/keys
64cp -r %{_builddir}/%{name}-%{version}/lib/* %{buildroot}/opt/raptor/web/lib
65cp -r %{_builddir}/%{name}-%{version}/webapp/* %{buildroot}/opt/raptor/web/webapp
66cp -r %{_builddir}/%{name}-%{version}/%{name}.jar %{buildroot}/opt/raptor/web
67
68# Install initscript
69%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
70    install -m 0755 %{_builddir}/%{name}-%{version}/bin/raptorwebd %{buildroot}%{_initrddir}/raptorwebd
71%if "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
72    %{__ln_s} -f %{_initrddir}/raptorwebd %{buildroot}%{_sbindir}/rcraptorwebd
73%endif
74%endif
75
76
77 
78%clean
79
80# Remove everything in the buildroot
81[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
82
83 
84 
85%post
86
87# Once the RPM is installed, key generation for this Web instance should take place
88# But only if installing, not ugprading!
89if [ $1 == 1 ] ; then
90    host=`hostname -f`
91
92    # Only run these commands if keytool exists
93    if command -v keytool > /dev/null; then
94        keytool -genkey -alias raptorweb -keystore /opt/raptor/web/keys/raptor-web.jks -storepass changeit -keypass changeit -dname "CN=$host,ou=WEB,o=Raptor" -validity 7300 -keyalg RSA -keysize 2048
95        keytool -export -alias raptorweb -keystore /opt/raptor/web/keys/raptor-web.jks -storepass changeit -file /opt/raptor/web/keys/raptor-web-public.crt
96    else
97        echo ERROR: keytool command not found - automatic key generation for Raptor Web has not taken place and must be performed manually!
98    fi
99fi
100 
101# And then we want to add the service's initscript
102%if "%{_vendor}" == "redhat" || "%{_vendor}" == "Mandriva"
103    # Add the service to the usual runlevels
104    /sbin/chkconfig --add raptorwebd
105   
106    # If upgrading, restart if the daemon is already running
107    if [ $1 -gt 1 ] ; then
108        /etc/init.d/raptorwebd status 1>/dev/null && /etc/init.d/raptorwebd restart 1>/dev/null
109        exit 0
110    fi
111%endif
112%if "%{_vendor}" == "suse" || "%{_vendor}" == "Mandriva"
113    # Add the service to the usual runlevels
114    cd /
115    %insserv_force_if_yast raptorwebd
116%endif
117
118 
119%preun
120
121# Stop the service before uninstalling
122%if "%{_vendor}" == "redhat"
123    if [ $1 == 0 ] ; then
124        /sbin/service raptorwebd stop >/dev/null 2>&1
125        /sbin/chkconfig --del raptorwebd
126    fi
127%endif
128%if "%{_vendor}" == "suse"
129    %stop_on_removal raptorwebd
130%endif
131exit 0
132
133 
134%postun
135
136 
137%files
138%defattr(-,root,root,-)
139%dir /opt/raptor
140%dir /opt/raptor/web
141%dir /opt/raptor/web/conf
142%dir /opt/raptor/web/keys
143%dir /opt/raptor/web/lib
144%dir /opt/raptor/web/logs
145/opt/raptor/web/webapp
146%config /opt/raptor/web/conf/dashboard-statistics.xml
147%config /opt/raptor/web/conf/web-core.xml
148%config(noreplace) /opt/raptor/web/conf/logging.xml
149%config(noreplace) /opt/raptor/web/conf/metadata.xml
150%config(noreplace) /opt/raptor/web/conf/mua-endpoints.xml
151%config(noreplace) /opt/raptor/web/conf/server.properties
152%config(noreplace) /opt/raptor/web/conf/users.xml
153%config(noreplace) /opt/raptor/web/keys/authorised-keys.jks
154/opt/raptor/web/lib/*.jar
155/opt/raptor/web/%{name}.jar
156%if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
157    %config %{_initrddir}/raptorwebd
158%endif
159%if "%{_vendor}" == "suse"
160    %{_sbindir}/rcraptorwebd
161%endif
162
163%changelog
164* Fri Jun 3 2011  Rhys Smith <smith@cardiff.ac.uk>  0.1.1-1
165- Changed rev for v0.1.1 release.
166
167* Mon May 16 2011  Rhys Smith <smith@cardiff.ac.uk>  0.1.0-1
168- First version.
Note: See TracBrowser for help on using the repository browser.