]> git.proxmox.com Git - mirror_corosync-qdevice.git/blob - corosync-qdevice.spec.in
spec: Use different BuildRequires for SUSE
[mirror_corosync-qdevice.git] / corosync-qdevice.spec.in
1 @ALPHATAG@
2 @NUMCOMM@
3 @DIRTY@
4
5 # Conditionals
6 # Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
7 # to disable or enable specific features
8 %bcond_with runautogen
9 %bcond_with systemd
10
11 %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
12 %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
13
14 Name: corosync-qdevice
15 Summary: The Corosync Cluster Engine Qdevice
16 Version: @version@
17 Release: 1%{?gitver}%{?dist}
18 License: BSD
19 URL: https://github.com/corosync/corosync-qdevice
20 Source0: https://github.com/corosync/corosync-qdevice/releases/download/v%{version}%{?gittarver}/%{name}-%{version}%{?gittarver}.tar.gz
21
22 # Runtime bits
23 Requires: corosync >= 2.4.0
24 Requires: corosynclib >= 2.4.0
25 Requires: nss-tools
26
27 %if %{with systemd}
28 %{?systemd_requires}
29 BuildRequires: systemd
30 BuildRequires: systemd-devel
31 %else
32 Requires(post): /sbin/chkconfig
33 Requires(preun): /sbin/chkconfig
34 %endif
35
36 # Build bits
37 BuildRequires: gcc
38 BuildRequires: corosynclib-devel
39 BuildRequires: libqb-devel
40 BuildRequires: sed
41
42 %if 0%{?suse_version}
43 BuildRequires: groff-full
44 %else
45 BuildRequires: groff
46 %endif
47
48 %if 0%{?suse_version}
49 BuildRequires: mozilla-nss-devel
50 %else
51 BuildRequires: nss-devel
52 %endif
53
54 %if %{with runautogen}
55 BuildRequires: autoconf automake libtool
56 %endif
57
58 %prep
59 %setup -q -n %{name}-%{version}%{?gittarver}
60
61 %build
62 %if %{with runautogen}
63 ./autogen.sh
64 %endif
65
66 %{configure} \
67 %if %{with systemd}
68 --enable-systemd \
69 %endif
70 --enable-qdevices \
71 --enable-qnetd \
72 --with-initddir=%{_initrddir} \
73 --with-systemddir=%{_unitdir}
74
75 make %{_smp_mflags}
76
77 %install
78 make install DESTDIR=%{buildroot}
79
80 ## tree fixup
81 # drop docs and html docs for now
82 rm -rf %{buildroot}%{_docdir}/*
83 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
84 # /etc/sysconfig/corosync-qdevice
85 install -m 644 init/corosync-qdevice.sysconfig.example \
86 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
87 # /etc/sysconfig/corosync-qnetd
88 install -m 644 init/corosync-qnetd.sysconfig.example \
89 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
90
91 %if %{with systemd}
92 sed -i -e 's/^#User=/User=/' \
93 %{buildroot}%{_unitdir}/corosync-qnetd.service
94 %else
95 sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
96 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
97 %endif
98
99 %description
100 This package contains the Corosync Cluster Engine Qdevice, script for creating
101 NSS certificates and an init script.
102
103 %post
104 %if %{with systemd} && 0%{?systemd_post:1}
105 %systemd_post corosync-qdevice.service
106 %else
107 if [ $1 -eq 1 ]; then
108 /sbin/chkconfig --add corosync-qdevice || :
109 fi
110 %endif
111
112 %preun
113 %if %{with systemd} && 0%{?systemd_preun:1}
114 %systemd_preun corosync-qdevice.service
115 %else
116 if [ $1 -eq 0 ]; then
117 /sbin/service corosync-qdevice stop &>/dev/null || :
118 /sbin/chkconfig --del corosync-qdevice || :
119 fi
120 %endif
121
122 %postun
123 %if %{with systemd} && 0%{?systemd_postun:1}
124 %systemd_postun corosync-qdevice.service
125 %endif
126
127 %files
128 %dir %{_sysconfdir}/corosync/qdevice
129 %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
130 %dir %{_localstatedir}/run/corosync-qdevice
131 %{_sbindir}/corosync-qdevice
132 %{_sbindir}/corosync-qdevice-net-certutil
133 %{_sbindir}/corosync-qdevice-tool
134 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
135 %if %{with systemd}
136 %{_unitdir}/corosync-qdevice.service
137 %else
138 %{_initrddir}/corosync-qdevice
139 %endif
140 %{_mandir}/man8/corosync-qdevice-tool.8*
141 %{_mandir}/man8/corosync-qdevice-net-certutil.8*
142 %{_mandir}/man8/corosync-qdevice.8*
143
144 %package -n corosync-qnetd
145 Summary: The Corosync Cluster Engine Qdevice Network Daemon
146 Requires: nss-tools
147 Requires(pre): shadow-utils
148
149 %if %{with systemd}
150 %{?systemd_requires}
151 %endif
152
153 %description -n corosync-qnetd
154 This package contains the Corosync Cluster Engine Qdevice Network Daemon,
155 script for creating NSS certificates and an init script.
156
157 %pre -n corosync-qnetd
158 getent group coroqnetd >/dev/null || groupadd -r coroqnetd
159 getent passwd coroqnetd >/dev/null || \
160 useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
161 exit 0
162
163 %post -n corosync-qnetd
164 %if %{with systemd} && 0%{?systemd_post:1}
165 %systemd_post corosync-qnetd.service
166 %else
167 if [ $1 -eq 1 ]; then
168 /sbin/chkconfig --add corosync-qnetd || :
169 fi
170 %endif
171
172 %preun -n corosync-qnetd
173 %if %{with systemd} && 0%{?systemd_preun:1}
174 %systemd_preun corosync-qnetd.service
175 %else
176 if [ $1 -eq 0 ]; then
177 /sbin/service corosync-qnetd stop &>/dev/null || :
178 /sbin/chkconfig --del corosync-qnetd || :
179 fi
180 %endif
181
182 %postun -n corosync-qnetd
183 %if %{with systemd} && 0%{?systemd_postun:1}
184 %systemd_postun corosync-qnetd.service
185 %endif
186
187 %files -n corosync-qnetd
188 %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
189 %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
190 %{_bindir}/corosync-qnetd
191 %{_bindir}/corosync-qnetd-certutil
192 %{_bindir}/corosync-qnetd-tool
193 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
194 %if %{with systemd}
195 %{_unitdir}/corosync-qnetd.service
196 %else
197 %{_initrddir}/corosync-qnetd
198 %endif
199 %{_mandir}/man8/corosync-qnetd-tool.8*
200 %{_mandir}/man8/corosync-qnetd-certutil.8*
201 %{_mandir}/man8/corosync-qnetd.8*
202
203 %changelog
204 * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
205 - Autotools generated version