]> git.proxmox.com Git - mirror_corosync-qdevice.git/blame - corosync-qdevice.spec.in
qdevice: Propagate error to exit code
[mirror_corosync-qdevice.git] / corosync-qdevice.spec.in
CommitLineData
9a1955a7
JF
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
eae6806f
JF
8%@bcond_runautogen@ runautogen
9%@bcond_systemd@ systemd
9a1955a7
JF
10
11%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
12%global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
13
14Name: corosync-qdevice
15Summary: The Corosync Cluster Engine Qdevice
16Version: @version@
17Release: 1%{?gitver}%{?dist}
18License: BSD
9a1955a7
JF
19URL: https://github.com/corosync/corosync-qdevice
20Source0: https://github.com/corosync/corosync-qdevice/releases/download/v%{version}%{?gittarver}/%{name}-%{version}%{?gittarver}.tar.gz
21
22# Runtime bits
23Requires: corosync >= 2.4.0
24Requires: corosynclib >= 2.4.0
25Requires: nss-tools
26
27%if %{with systemd}
debef989
JF
28%{?systemd_requires}
29BuildRequires: systemd
30BuildRequires: systemd-devel
9a1955a7
JF
31%else
32Requires(post): /sbin/chkconfig
33Requires(preun): /sbin/chkconfig
34%endif
35
36# Build bits
e5e15756 37BuildRequires: gcc
9a1955a7 38BuildRequires: corosynclib-devel
9a1955a7 39BuildRequires: libqb-devel
9a1955a7
JF
40BuildRequires: sed
41
5e029a41
JF
42%if 0%{?suse_version}
43BuildRequires: groff-full
44%else
45BuildRequires: groff
46%endif
47
48%if 0%{?suse_version}
49BuildRequires: mozilla-nss-devel
50%else
51BuildRequires: nss-devel
52%endif
53
9a1955a7
JF
54%if %{with runautogen}
55BuildRequires: autoconf automake libtool
56%endif
9a1955a7
JF
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} \
77fb16e4
JF
73 --with-systemddir=%{_unitdir} \
74 --docdir=%{_docdir}
9a1955a7
JF
75
76make %{_smp_mflags}
77
78%install
9a1955a7
JF
79make install DESTDIR=%{buildroot}
80
81## tree fixup
82# drop docs and html docs for now
83rm -rf %{buildroot}%{_docdir}/*
84mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
85# /etc/sysconfig/corosync-qdevice
86install -m 644 init/corosync-qdevice.sysconfig.example \
87 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
88# /etc/sysconfig/corosync-qnetd
89install -m 644 init/corosync-qnetd.sysconfig.example \
90 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
91
92%if %{with systemd}
93sed -i -e 's/^#User=/User=/' \
94 %{buildroot}%{_unitdir}/corosync-qnetd.service
95%else
96sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
97 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
98%endif
99
9a1955a7
JF
100%description
101This package contains the Corosync Cluster Engine Qdevice, script for creating
102NSS certificates and an init script.
103
104%post
105%if %{with systemd} && 0%{?systemd_post:1}
106%systemd_post corosync-qdevice.service
107%else
108if [ $1 -eq 1 ]; then
109 /sbin/chkconfig --add corosync-qdevice || :
110fi
111%endif
112
113%preun
114%if %{with systemd} && 0%{?systemd_preun:1}
115%systemd_preun corosync-qdevice.service
116%else
117if [ $1 -eq 0 ]; then
118 /sbin/service corosync-qdevice stop &>/dev/null || :
119 /sbin/chkconfig --del corosync-qdevice || :
120fi
121%endif
122
123%postun
124%if %{with systemd} && 0%{?systemd_postun:1}
debef989 125%systemd_postun corosync-qdevice.service
9a1955a7
JF
126%endif
127
128%files
9a1955a7
JF
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
146Summary: The Corosync Cluster Engine Qdevice Network Daemon
9a1955a7
JF
147Requires: nss-tools
148Requires(pre): shadow-utils
9a1955a7
JF
149
150%if %{with systemd}
debef989 151%{?systemd_requires}
9a1955a7
JF
152%endif
153
154%description -n corosync-qnetd
155This package contains the Corosync Cluster Engine Qdevice Network Daemon,
156script for creating NSS certificates and an init script.
157
158%pre -n corosync-qnetd
159getent group coroqnetd >/dev/null || groupadd -r coroqnetd
160getent passwd coroqnetd >/dev/null || \
161 useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
162exit 0
163
164%post -n corosync-qnetd
165%if %{with systemd} && 0%{?systemd_post:1}
166%systemd_post corosync-qnetd.service
167%else
168if [ $1 -eq 1 ]; then
169 /sbin/chkconfig --add corosync-qnetd || :
170fi
171%endif
172
173%preun -n corosync-qnetd
174%if %{with systemd} && 0%{?systemd_preun:1}
175%systemd_preun corosync-qnetd.service
176%else
177if [ $1 -eq 0 ]; then
178 /sbin/service corosync-qnetd stop &>/dev/null || :
179 /sbin/chkconfig --del corosync-qnetd || :
180fi
181%endif
182
183%postun -n corosync-qnetd
184%if %{with systemd} && 0%{?systemd_postun:1}
debef989 185%systemd_postun corosync-qnetd.service
9a1955a7
JF
186%endif
187
188%files -n corosync-qnetd
9a1955a7
JF
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