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