Post-process of shib.conf on RH only.
[shibboleth/cpp-sp.git] / shibboleth.spec.in
1 Name:           @PACKAGE_NAME@
2 Version:        @PACKAGE_VERSION@
3 Release:        1
4 Summary:        Open source system for attribute-based Web SSO
5 Group:          Productivity/Networking/Security
6 Vendor:         Internet2
7 License:        Apache 2.0
8 URL:            http://shibboleth.internet2.edu/
9 Source:         %{name}-sp-%{version}.tar.gz
10 BuildRoot:      %{_tmppath}/%{name}-%{version}-root
11 Requires:       openssl
12 PreReq:         xmltooling-schemas, opensaml-schemas
13 %if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1130
14 PreReq:         %{insserv_prereq}
15 BuildRequires:  libXerces-c-devel >= 2.8.0
16 %else
17 BuildRequires:  libxerces-c-devel >= 2.8.0
18 %endif
19 BuildRequires:  libxml-security-c-devel >= 1.4.0
20 BuildRequires:  libxmltooling-devel >= 1.5
21 BuildRequires:  libsaml-devel >= 2.5
22 %{?_with_log4cpp:BuildRequires: liblog4cpp-devel >= 1.0}
23 %{!?_with_log4cpp:BuildRequires: liblog4shib-devel}
24 %if 0%{?rhel} >= 6 || 0%{?centos_version} >= 600
25 Requires:               libcurl-openssl >= 7.21.7
26 BuildRequires:  chrpath
27 %endif
28 BuildRequires:  gcc-c++, zlib-devel
29 %{!?_without_doxygen:BuildRequires: doxygen}
30 %{!?_without_odbc:BuildRequires:unixODBC-devel}
31 %{?_with_fastcgi:BuildRequires: fcgi-devel}
32 %if "%{_vendor}" == "redhat"
33 %{!?_without_builtinapache:BuildRequires: httpd-devel}
34 BuildRequires: redhat-rpm-config
35 %endif
36 %if "%{_vendor}" == "suse"
37 %{!?_without_builtinapache:BuildRequires: apache2-devel}
38 %endif
39
40 %if "%{_vendor}" == "suse"
41 %define pkgdocdir %{_docdir}/%{name}
42 %else
43 %define pkgdocdir %{_docdir}/%{name}-%{version}
44 %endif
45
46 %description
47 Shibboleth is a Web Single Sign-On implementations based on OpenSAML
48 that supports multiple protocols, federated identity, and the extensible
49 exchange of rich attributes subject to privacy controls.
50
51 This package contains the Shibboleth Service Provider runtime libraries,
52 daemon, default plugins, and Apache module(s).
53
54 %package devel
55 Summary:        Shibboleth Development Headers
56 Group:          Development/Libraries/C and C++
57 Requires:       %{name} = %{version}-%{release}
58 %if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1130
59 Requires:       libXerces-c-devel >= 2.8.0
60 %else
61 Requires:       libxerces-c-devel >= 2.8.0
62 %endif
63 Requires:       libxml-security-c-devel >= 1.4.0
64 Requires:       libxmltooling-devel >= 1.5
65 Requires:       libsaml-devel >= 2.5
66 %{?_with_log4cpp:Requires: liblog4cpp-devel >= 1.0}
67 %{!?_with_log4cpp:Requires: liblog4shib-devel}
68
69 %description devel
70 Shibboleth is a Web Single Sign-On implementations based on OpenSAML
71 that supports multiple protocols, federated identity, and the extensible
72 exchange of rich attributes subject to privacy controls.
73
74 This package includes files needed for development with Shibboleth.
75
76 %prep
77 %setup -q
78
79 %build
80 %configure %{?_without_odbc:--disable-odbc} %{?_without_adfs:--disable-adfs} %{?_with_fastcgi} %{?_with_memcached} %{?shib_options}
81 %{__make} pkgdocdir=%{pkgdocdir}
82
83 %install
84 %{__make} install NOKEYGEN=1 DESTDIR=$RPM_BUILD_ROOT pkgdocdir=%{pkgdocdir}
85
86 %if "%{_vendor}" == "suse"
87         %{__sed} -i "s/\/var\/log\/httpd/\/var\/log\/apache2/g" \
88                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/native.logger
89 %endif
90 %if 0%{?rhel} >= 6 || 0%{?centos_version} >= 600
91         %{__sed} -i "s/#_RHEL6_//g" \
92                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-redhat
93         %{__sed} -i "s/\/opt\/shibboleth\/lib/\/opt\/shibboleth\/%{_lib}/g" \
94                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-redhat
95         chrpath -d $RPM_BUILD_ROOT%{_sbindir}/shibd
96         chrpath -d $RPM_BUILD_ROOT%{_bindir}/mdquery
97         chrpath -d $RPM_BUILD_ROOT%{_bindir}/resolvertest
98 %endif
99
100 # Plug the SP into the built-in Apache on a recognized system.
101 touch rpm.filelist
102 APACHE_CONFIG="no"
103 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_13.so ] ; then
104         APACHE_CONFIG="apache.config"
105 fi
106 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_20.so ] ; then
107         APACHE_CONFIG="apache2.config"
108 fi
109 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_22.so ] ; then
110         APACHE_CONFIG="apache22.config"
111 fi
112 %{?_without_builtinapache:APACHE_CONFIG="no"}
113 if [ "$APACHE_CONFIG" != "no" ] ; then
114         APACHE_CONFD="no"
115         if [ -d %{_sysconfdir}/httpd/conf.d ] ; then
116                 APACHE_CONFD="%{_sysconfdir}/httpd/conf.d"
117         fi
118         if [ -d %{_sysconfdir}/apache2/conf.d ] ; then
119                 APACHE_CONFD="%{_sysconfdir}/apache2/conf.d"
120         fi
121         if [ "$APACHE_CONFD" != "no" ] ; then
122                 %{__mkdir} -p $RPM_BUILD_ROOT$APACHE_CONFD
123                 %{__cp} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/$APACHE_CONFIG $RPM_BUILD_ROOT$APACHE_CONFD/shib.conf 
124                 echo "%config(noreplace) $APACHE_CONFD/shib.conf" > rpm.filelist
125         fi
126 fi
127
128 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
129         # %{_initddir} not yet in RHEL5, use deprecated %{_initrddir}
130         install -d -m 0755 $RPM_BUILD_ROOT%{_initrddir}
131         install -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-%{_vendor} $RPM_BUILD_ROOT%{_initrddir}/shibd
132 %if "%{_vendor}" == "suse"
133         install -d -m 0755 $RPM_BUILD_ROOT/%{_sbindir}
134         %{__ln_s} -f %{_initrddir}/shibd $RPM_BUILD_ROOT%{_sbindir}/rcshibd
135 %endif
136 %endif
137
138 %check
139 %{__make} check
140
141 %clean
142 [ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT
143
144 %post
145 %ifnos solaris2.8 solaris2.9 solaris2.10
146 /sbin/ldconfig
147 %endif
148
149 # Key generation
150 cd %{_sysconfdir}/%{name}
151 sh ./keygen.sh -b
152
153 %if "%{_vendor}" == "redhat"
154         if [ "$1" -gt "1" ] ; then
155                 # On Red Hat with shib.conf installed, clean up old Alias commands
156                 # by pointing them at new version-independent /usr/share/share tree.
157                 # Any Aliases we didn't create we assume are custom files.
158                 # This is to accomodate making shib.conf a noreplace config file.
159                 # We can't do this for SUSE, because they disallow changes to
160                 # packaged files in scriplets.
161                 APACHE_CONF="no"
162                 if [ -f %{_sysconfdir}/httpd/conf.d/shib.conf ] ; then
163                         APACHE_CONF="%{_sysconfdir}/httpd/conf.d/shib.conf"
164                 fi
165                 if [ "$APACHE_CONF" != "no" ] ; then
166                         %{__sed} -i "s/\/usr\/share\/doc\/shibboleth\(\-\(.\)\{1,\}\)\{0,1\}\/main\.css/\/usr\/share\/shibboleth\/main.css/g" \
167                                 $APACHE_CONF
168                         %{__sed} -i "s/\/usr\/share\/doc\/shibboleth\(\-\(.\)\{1,\}\)\{0,1\}\/logo\.jpg/\/usr\/share\/shibboleth\/logo.jpg/g" \
169                                 $APACHE_CONF
170                 fi
171         fi
172
173         # This adds the proper /etc/rc*.d links for the script
174         /sbin/chkconfig --add shibd
175         # On upgrade, restart components if they're already running.
176         if [ "$1" -gt "1" ] ; then
177                 /etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd restart 1>/dev/null
178                 %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
179                 exit 0
180         fi
181 %endif
182 %if "%{_vendor}" == "suse"
183         # This adds the proper /etc/rc*.d links for the script
184         cd /
185         %insserv_force_if_yast shibd
186 %endif
187
188 %preun
189 %if "%{_vendor}" == "redhat"
190         if [ "$1" = 0 ] ; then
191                 /sbin/service shibd stop >/dev/null 2>&1
192                 /sbin/chkconfig --del shibd
193                 %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
194         fi
195 %endif
196 %if "%{_vendor}" == "suse"
197         %stop_on_removal shibd
198         if [ "$1" = 0 ] ; then
199                 %{!?_without_builtinapache:/etc/init.d/apache2 status 1>/dev/null && /etc/init.d/apache2 restart 1>/dev/null}
200         fi
201 %endif
202 exit 0
203
204 %postun
205 %ifnos solaris2.8 solaris2.9 solaris2.10
206 /sbin/ldconfig
207 %endif
208 %if "%{_vendor}" == "suse"
209 cd /
210 %restart_on_update shibd
211 %{!?_without_builtinapache:%restart_on_update apache2}
212 %{insserv_cleanup}
213 %endif
214
215 %posttrans
216 # ugly hack if init script got removed during %postun by upgraded (buggy/2.1) package
217 %if "%{_vendor}" == "redhat"
218         if [ ! -f %{_initrddir}/shibd ] ; then
219                 if [ -f %{_sysconfdir}/%{name}/shibd-%{_vendor} ] ; then
220                         %{__cp} -p %{_sysconfdir}/%{name}/shibd-%{_vendor} %{_initrddir}/shibd
221                         %{__chmod} 755 %{_initrddir}/shibd
222                         /sbin/chkconfig --add shibd
223         fi
224 fi
225 %endif
226
227 %files -f rpm.filelist
228 %defattr(-,root,root,-)
229 %{_sbindir}/shibd
230 %{_bindir}/mdquery
231 %{_bindir}/resolvertest
232 %{_libdir}/libshibsp.so.*
233 %{_libdir}/libshibsp-lite.so.*
234 %dir %{_libdir}/%{name}
235 %{_libdir}/%{name}/*
236 %exclude %{_libdir}/%{name}/*.la
237 %attr(0750,root,root) %dir %{_localstatedir}/log/%{name}
238 %dir %{_localstatedir}/run/%{name}
239 %dir %{_datadir}/xml/%{name}
240 %{_datadir}/xml/%{name}/*
241 %dir %{_datadir}/%{name}
242 %{_datadir}/%{name}/*
243 %dir %{_sysconfdir}/%{name}
244 %config(noreplace) %{_sysconfdir}/%{name}/*.xml
245 %config(noreplace) %{_sysconfdir}/%{name}/*.html
246 %config(noreplace) %{_sysconfdir}/%{name}/*.logger
247 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
248 %config %{_initrddir}/shibd
249 %endif
250 %if "%{_vendor}" == "suse"
251 %{_sbindir}/rcshibd
252 %endif
253 %{_sysconfdir}/%{name}/*.dist
254 %{_sysconfdir}/%{name}/apache*.config
255 %{_sysconfdir}/%{name}/shibd-*
256 %attr(0755,root,root) %{_sysconfdir}/%{name}/keygen.sh
257 %attr(0755,root,root) %{_sysconfdir}/%{name}/metagen.sh
258 %{_sysconfdir}/%{name}/*.xsl
259 %doc %{pkgdocdir}
260 %exclude %{pkgdocdir}/api
261
262 %files devel
263 %defattr(-,root,root,-)
264 %{_includedir}/*
265 %{_libdir}/libshibsp.so
266 %{_libdir}/libshibsp-lite.so
267 %doc %{pkgdocdir}/api
268
269 %changelog
270 * Tue Aug 9 2011  Scott Cantor  <cantor.2@osu.edu>  - 2.5-1
271 - Move logo and stylesheet to version-independent tree
272 - Make shib.conf noreplace
273 - Post-fixup of Alias commands in older shib.conf
274
275 * Sun Jun 26 2011  Scott Cantor  <cantor.2@osu.edu>  - 2.4.3-1
276 - Log files shouldn't be world readable.
277 - Explicit requirement for libcurl-openssl on RHEL6
278 - Uncomment LD_LIBRARY_PATH in init script for RHEL6 
279 - Remove rpath from binaries for RHEL6
280
281 * Fri Dec 25 2009  Scott Cantor  <cantor.2@osu.edu>  - 2.4-1
282 - Update dependencies.
283
284 * Mon Nov 23 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.3.1-1
285 - Reset revision for 2.3.1 release
286
287 * Wed Aug 19 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-2
288 - SuSE init script changes
289 - Restart Apache on removal, not just upgrade
290 - Fix scriptlet exit values when Apache is stopped
291
292 * Mon Aug 10 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-1
293 - Doc handling changes
294 - SuSE init script
295
296 * Tue Aug 4 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-1
297 - Initial version for 2.2.1, with shibd/httpd restart on upgrade
298
299 * Thu Jun 25 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2-3
300 - Add additional cleanup to posttrans fix
301
302 * Tue Jun 23 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2-2
303 - Reverse without_builtinapache macro test
304 - Fix init script handling on Red Hat to handle upgrades
305
306 * Wed Dec 3 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.2-1
307 - Bump minor version.
308 - Make keygen.sh executable.
309 - Fixing SUSE Xerces dependency name.
310 - Optionally package shib.conf.
311
312 * Tue Jun 10 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.1-1
313 - Change shib.conf handling to treat as config file.
314
315 * Mon Mar 17 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.0-6
316 - Official release.
317
318 * Fri Jan 18 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.0-5
319 - Release candidate 1.
320
321 * Sun Oct 21 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-4
322 - libexec -> lib/shibboleth changes
323 - Added doc subpackage
324
325 * Thu Aug 16 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-3
326 - First public beta.
327
328 * Fri Jul 13 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-2
329 - Second alpha release.
330
331 * Sun Jun 10 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-1
332 - First alpha release.
333
334 * Mon Oct 2 2006 Scott Cantor   <cantor.2@osu.edu>  - 1.3-11
335 - Applied fix for secadv 20061002
336 - Fix for metadata loader loop
337
338 * Wed Jun 15 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-10
339 - Applied fix for sec 20060615
340
341 * Fri Apr 15 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-9
342 - Misc. patches, SuSE, Apache 2.2, gcc 4.1, and 64-bit support
343
344 * Mon Jan 9 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-8
345 - Applied new fix for secadv 20060109
346
347 * Tue Nov 8 2005 Scott Cantor  <cantor.2@osu.edu>  - 1.3-7
348 - Applied new fix for secadv 20050901 plus rollup
349
350 * Fri Sep 23 2005 Scott Cantor  <cantor.2@osu.edu>  - 1.3-6
351 - Minor patches and default config changes
352 - pidfile patch
353 - Fix shib.conf creation
354 - Integrated init.d script
355 - Prevent replacement of config files
356
357 * Thu Sep 1 2005  Scott Cantor  <cantor.2@osu.edu>  - 1.3-5
358 - Applied fix for secadv 20050901 plus rollup of NSAPI fixes
359
360 * Sun Apr 24 2005  Scott Cantor  <cantor.2@osu.edu>  - 1.3-1
361 - Updated test programs and location of schemas.
362 - move siterefresh to to sbindir
363
364 * Fri Apr  1 2005  Derek Atkins  <derek@ihtfp.com>  - 1.3-1
365 - Add selinux-targeted-policy package
366 - move shar to sbindir
367
368 * Tue Oct 19 2004  Derek Atkins  <derek@ihtfp.com>  - 1.2-1
369 - Create SPEC file based on various versions in existence.