certmaster.spec: Try to simplify the support for rhel3+python2.3 a little bit.
[certmaster.git] / certmaster.spec
1
2
3 # We can run on Rhel 3'ish systems, but only if python2.3 is installed
4 %if 0%{?rhel} == 3
5 %define __python_ver 2.3
6 %endif
7 %define python python%{?__python_ver}
8 %define __python /usr/bin/%{python}
9
10
11 %{!?python_version: %define python_version %(%{__python} -c "from distutils.sysconfig import get_python_version; print get_python_version()")}
12 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
13
14 %define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
15
16
17 Summary: Remote certificate distribution framework
18 Name: certmaster
19 Source1: version
20 Version: %(echo `awk '{ print $1 }' %{SOURCE1}`)
21 Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist}
22 Source0: %{name}-%{version}.tar.gz
23 License: GPLv2+
24 Group: Applications/System
25 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
26 BuildArch: noarch
27 Url: https://fedorahosted.org/certmaster
28
29 %if 0%{?rhel} == 3
30 Requires: %{python}
31 Requires: pyOpenSSL-py23
32 %else
33 Requires: python >= 2.3
34 Requires: pyOpenSSL
35 %endif
36
37 # NOTE: if you
38 BuildRequires: %{python}-devel
39 %if %is_suse
40 BuildRequires: gettext-devel
41 %else
42 %if 0%{?fedora} >= 8
43 BuildRequires: python-setuptools-devel
44 %else
45 %if 0%{?rhel} >= 5
46 BuildRequires: python-setuptools
47 %endif
48 %endif
49 %endif
50
51
52
53 %description
54
55 certmaster is a easy mechanism for distributing SSL certificates
56
57 %prep
58 %setup -q
59
60 %build
61 %{__python} setup.py build
62
63 %install
64 test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
65 %{__python} setup.py install --prefix=/usr --root=$RPM_BUILD_ROOT
66
67 %clean
68 rm -fr $RPM_BUILD_ROOT
69
70 %files
71 %defattr(-, root, root, -)
72 %if "%{python_version}" >= "2.5"
73 %{python_sitelib}/certmaster*.egg-info
74 %endif
75 %{_bindir}/certmaster
76 %{_bindir}/certmaster-request
77 %{_bindir}/certmaster-ca
78 /etc/init.d/certmaster
79 %dir %{_sysconfdir}/%{name}
80 %dir %{_sysconfdir}/%{name}/minion-acl.d/
81 %dir %{_sysconfdir}/pki/%{name}
82 %config(noreplace) /etc/certmaster/minion.conf
83 %config(noreplace) /etc/certmaster/certmaster.conf
84 %config(noreplace) /etc/logrotate.d/certmaster_rotate
85 %dir %{python_sitelib}/certmaster
86 %{python_sitelib}/certmaster/*.py*
87 %dir /var/log/certmaster
88 %dir /var/lib/certmaster
89 %dir /var/lib/certmaster/triggers/sign/
90 %dir /var/lib/certmaster/triggers/sign/pre
91 %dir /var/lib/certmaster/triggers/sign/post
92 %dir /var/lib/certmaster/triggers/request/
93 %dir /var/lib/certmaster/triggers/request/pre
94 %dir /var/lib/certmaster/triggers/request/post
95 %dir /var/lib/certmaster/triggers/remove/
96 %dir /var/lib/certmaster/triggers/remove/pre
97 %dir /var/lib/certmaster/triggers/remove/post
98 %doc AUTHORS README LICENSE
99 %{_mandir}/man1/*.1.gz
100
101
102 %post
103 # for suse
104 if [ -x /usr/lib/lsb/install_initd ]; then
105 /usr/lib/lsb/install_initd /etc/init.d/certmaster
106 # for red hat distros
107 elif [ -x /sbin/chkconfig ]; then
108 /sbin/chkconfig --add certmaster
109 # or, the old fashioned way
110 else
111 for i in 2 3 4 5; do
112 ln -sf /etc/init.d/certmaster /etc/rc.d/rc${i}.d/S99certmaster
113 done
114 for i in 1 6; do
115 ln -sf /etc/init.d/certmaster /etc/rc.d/rc${i}.d/k01certmaster
116 done
117 fi
118 exit 0
119
120 %preun
121 if [ "$1" = 0 ] ; then
122 /etc/init.d/certmaster stop > /dev/null 2>&1
123 if [ -x /usr/lib/lsb/remove_initd ]; then
124 /usr/lib/lsb/remove_initd /etc/init.d/certmaster
125 elif [ -x /sbin/chkconfig ]; then
126 /sbin/chkconfig --del certmaster
127 else
128 rm -f /etc/rc.d/rc?.d/???certmaster
129 fi
130 fi
131
132
133 %changelog
134 * Mon Jan 19 2009 Adrian Likins <alikins@redhat.com> - 0.24.4
135 - make inclusion of egginfo dependant on having python >= 2.5
136 - remove need for patch on rhel3+python2.4 cases (distutils should
137 do all the /usr/bin/python renaming now)
138 - minor reformatting changes
139
140 * Tue Jan 06 2009 Greg Swift <gregswift@gmail.com> - 0.24-3
141 - Fixed spec because it was only building in rhel3
142
143 * Wed Dec 31 2008 Greg Swift <gregswift@gmail.com> - 0.24-2
144 - Patched SPEC to build on rhel3 with python2.3
145 - Added Patch0 to handle python2.3 if on rhel3
146
147 * Mon Dec 12 2008 Adrian Likins <alikins@redhat.com> - 0.24-1
148 - add missing dirs as per bz#473633
149
150 * Mon Jun 6 2008 Adrian Likins <alikins@redhat.com> - 0.20-2
151 - fix fedora bug #441283 - typo in postinstall scriptlet
152 (the init.d symlinks for runlevels 1 and 6 were created wrong)
153
154 * Tue Apr 15 2008 Michael DeHaan <mdehaan@redhat.com> - 0.20-1
155 - new release
156 - fix changelog versions
157
158 * Tue Apr 15 2008 Steve Salevan <ssalevan@redhat.com> - 0.19-3
159 - added in trigger directories
160
161 * Mon Mar 17 2008 Adrian Likins <alikins@redhat.com> - 0.19-2
162 - removed unused minion/ and overlord/ dirs
163
164 * Mon Feb 25 2008 Adrian Likins <alikins@redhat.com> - 0.19-1
165 - remove certmasterd references
166
167 * Thu Feb 7 2008 Michael DeHaan <mdehaan@redhat.com> - 0.18-1
168 - initial version, split off from func project, WIP
169