]> git.proxmox.com Git - mirror_corosync-qdevice.git/blob - corosync-qdevice.spec.in
qdevice: Propagate error to exit code
[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_runautogen@ runautogen
9 %@bcond_systemd@ 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 --docdir=%{_docdir}
75
76 make %{_smp_mflags}
77
78 %install
79 make install DESTDIR=%{buildroot}
80
81 ## tree fixup
82 # drop docs and html docs for now
83 rm -rf %{buildroot}%{_docdir}/*
84 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
85 # /etc/sysconfig/corosync-qdevice
86 install -m 644 init/corosync-qdevice.sysconfig.example \
87 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
88 # /etc/sysconfig/corosync-qnetd
89 install -m 644 init/corosync-qnetd.sysconfig.example \
90 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
91
92 %if %{with systemd}
93 sed -i -e 's/^#User=/User=/' \
94 %{buildroot}%{_unitdir}/corosync-qnetd.service
95 %else
96 sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
97 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
98 %endif
99
100 %description
101 This package contains the Corosync Cluster Engine Qdevice, script for creating
102 NSS certificates and an init script.
103
104 %post
105 %if %{with systemd} && 0%{?systemd_post:1}
106 %systemd_post corosync-qdevice.service
107 %else
108 if [ $1 -eq 1 ]; then
109 /sbin/chkconfig --add corosync-qdevice || :
110 fi
111 %endif
112
113 %preun
114 %if %{with systemd} && 0%{?systemd_preun:1}
115 %systemd_preun corosync-qdevice.service
116 %else
117 if [ $1 -eq 0 ]; then
118 /sbin/service corosync-qdevice stop &>/dev/null || :
119 /sbin/chkconfig --del corosync-qdevice || :
120 fi
121 %endif
122
123 %postun
124 %if %{with systemd} && 0%{?systemd_postun:1}
125 %systemd_postun corosync-qdevice.service
126 %endif
127
128 %files
129 %dir %{_sysconfdir}/corosync/qdevice
130 %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
131 %dir %{_localstatedir}/run/corosync-qdevice
132 %{_sbindir}/corosync-qdevice
133 %{_sbindir}/corosync-qdevice-net-certutil
134 %{_sbindir}/corosync-qdevice-tool
135 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
136 %if %{with systemd}
137 %{_unitdir}/corosync-qdevice.service
138 %else
139 %{_initrddir}/corosync-qdevice
140 %endif
141 %{_mandir}/man8/corosync-qdevice-tool.8*
142 %{_mandir}/man8/corosync-qdevice-net-certutil.8*
143 %{_mandir}/man8/corosync-qdevice.8*
144
145 %package -n corosync-qnetd
146 Summary: The Corosync Cluster Engine Qdevice Network Daemon
147 Requires: nss-tools
148 Requires(pre): shadow-utils
149
150 %if %{with systemd}
151 %{?systemd_requires}
152 %endif
153
154 %description -n corosync-qnetd
155 This package contains the Corosync Cluster Engine Qdevice Network Daemon,
156 script for creating NSS certificates and an init script.
157
158 %pre -n corosync-qnetd
159 getent group coroqnetd >/dev/null || groupadd -r coroqnetd
160 getent passwd coroqnetd >/dev/null || \
161 useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
162 exit 0
163
164 %post -n corosync-qnetd
165 %if %{with systemd} && 0%{?systemd_post:1}
166 %systemd_post corosync-qnetd.service
167 %else
168 if [ $1 -eq 1 ]; then
169 /sbin/chkconfig --add corosync-qnetd || :
170 fi
171 %endif
172
173 %preun -n corosync-qnetd
174 %if %{with systemd} && 0%{?systemd_preun:1}
175 %systemd_preun corosync-qnetd.service
176 %else
177 if [ $1 -eq 0 ]; then
178 /sbin/service corosync-qnetd stop &>/dev/null || :
179 /sbin/chkconfig --del corosync-qnetd || :
180 fi
181 %endif
182
183 %postun -n corosync-qnetd
184 %if %{with systemd} && 0%{?systemd_postun:1}
185 %systemd_postun corosync-qnetd.service
186 %endif
187
188 %files -n corosync-qnetd
189 %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
190 %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
191 %{_bindir}/corosync-qnetd
192 %{_bindir}/corosync-qnetd-certutil
193 %{_bindir}/corosync-qnetd-tool
194 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
195 %if %{with systemd}
196 %{_unitdir}/corosync-qnetd.service
197 %else
198 %{_initrddir}/corosync-qnetd
199 %endif
200 %{_mandir}/man8/corosync-qnetd-tool.8*
201 %{_mandir}/man8/corosync-qnetd-certutil.8*
202 %{_mandir}/man8/corosync-qnetd.8*
203
204 %changelog
205 * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
206 - Autotools generated version