]>
Commit | Line | Data |
---|---|---|
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 | |
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 | |
9a1955a7 JF |
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} | |
debef989 JF |
28 | %{?systemd_requires} |
29 | BuildRequires: systemd | |
30 | BuildRequires: systemd-devel | |
9a1955a7 JF |
31 | %else |
32 | Requires(post): /sbin/chkconfig | |
33 | Requires(preun): /sbin/chkconfig | |
34 | %endif | |
35 | ||
36 | # Build bits | |
e5e15756 | 37 | BuildRequires: gcc |
9a1955a7 JF |
38 | BuildRequires: corosynclib-devel |
39 | BuildRequires: groff | |
40 | BuildRequires: libqb-devel | |
41 | BuildRequires: nss-devel | |
42 | BuildRequires: sed | |
43 | ||
44 | %if %{with runautogen} | |
45 | BuildRequires: autoconf automake libtool | |
46 | %endif | |
9a1955a7 JF |
47 | |
48 | %prep | |
49 | %setup -q -n %{name}-%{version}%{?gittarver} | |
50 | ||
51 | %build | |
52 | %if %{with runautogen} | |
53 | ./autogen.sh | |
54 | %endif | |
55 | ||
56 | %{configure} \ | |
57 | %if %{with systemd} | |
58 | --enable-systemd \ | |
59 | %endif | |
60 | --enable-qdevices \ | |
61 | --enable-qnetd \ | |
62 | --with-initddir=%{_initrddir} \ | |
63 | --with-systemddir=%{_unitdir} | |
64 | ||
65 | make %{_smp_mflags} | |
66 | ||
67 | %install | |
9a1955a7 JF |
68 | make install DESTDIR=%{buildroot} |
69 | ||
70 | ## tree fixup | |
71 | # drop docs and html docs for now | |
72 | rm -rf %{buildroot}%{_docdir}/* | |
73 | mkdir -p %{buildroot}%{_sysconfdir}/sysconfig | |
74 | # /etc/sysconfig/corosync-qdevice | |
75 | install -m 644 init/corosync-qdevice.sysconfig.example \ | |
76 | %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice | |
77 | # /etc/sysconfig/corosync-qnetd | |
78 | install -m 644 init/corosync-qnetd.sysconfig.example \ | |
79 | %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd | |
80 | ||
81 | %if %{with systemd} | |
82 | sed -i -e 's/^#User=/User=/' \ | |
83 | %{buildroot}%{_unitdir}/corosync-qnetd.service | |
84 | %else | |
85 | sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \ | |
86 | %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd | |
87 | %endif | |
88 | ||
9a1955a7 JF |
89 | %description |
90 | This package contains the Corosync Cluster Engine Qdevice, script for creating | |
91 | NSS certificates and an init script. | |
92 | ||
93 | %post | |
94 | %if %{with systemd} && 0%{?systemd_post:1} | |
95 | %systemd_post corosync-qdevice.service | |
96 | %else | |
97 | if [ $1 -eq 1 ]; then | |
98 | /sbin/chkconfig --add corosync-qdevice || : | |
99 | fi | |
100 | %endif | |
101 | ||
102 | %preun | |
103 | %if %{with systemd} && 0%{?systemd_preun:1} | |
104 | %systemd_preun corosync-qdevice.service | |
105 | %else | |
106 | if [ $1 -eq 0 ]; then | |
107 | /sbin/service corosync-qdevice stop &>/dev/null || : | |
108 | /sbin/chkconfig --del corosync-qdevice || : | |
109 | fi | |
110 | %endif | |
111 | ||
112 | %postun | |
113 | %if %{with systemd} && 0%{?systemd_postun:1} | |
debef989 | 114 | %systemd_postun corosync-qdevice.service |
9a1955a7 JF |
115 | %endif |
116 | ||
117 | %files | |
9a1955a7 JF |
118 | %dir %{_sysconfdir}/corosync/qdevice |
119 | %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net | |
120 | %dir %{_localstatedir}/run/corosync-qdevice | |
121 | %{_sbindir}/corosync-qdevice | |
122 | %{_sbindir}/corosync-qdevice-net-certutil | |
123 | %{_sbindir}/corosync-qdevice-tool | |
124 | %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice | |
125 | %if %{with systemd} | |
126 | %{_unitdir}/corosync-qdevice.service | |
127 | %else | |
128 | %{_initrddir}/corosync-qdevice | |
129 | %endif | |
130 | %{_mandir}/man8/corosync-qdevice-tool.8* | |
131 | %{_mandir}/man8/corosync-qdevice-net-certutil.8* | |
132 | %{_mandir}/man8/corosync-qdevice.8* | |
133 | ||
134 | %package -n corosync-qnetd | |
135 | Summary: The Corosync Cluster Engine Qdevice Network Daemon | |
9a1955a7 JF |
136 | Requires: nss-tools |
137 | Requires(pre): shadow-utils | |
9a1955a7 JF |
138 | |
139 | %if %{with systemd} | |
debef989 | 140 | %{?systemd_requires} |
9a1955a7 JF |
141 | %endif |
142 | ||
143 | %description -n corosync-qnetd | |
144 | This package contains the Corosync Cluster Engine Qdevice Network Daemon, | |
145 | script for creating NSS certificates and an init script. | |
146 | ||
147 | %pre -n corosync-qnetd | |
148 | getent group coroqnetd >/dev/null || groupadd -r coroqnetd | |
149 | getent passwd coroqnetd >/dev/null || \ | |
150 | useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd | |
151 | exit 0 | |
152 | ||
153 | %post -n corosync-qnetd | |
154 | %if %{with systemd} && 0%{?systemd_post:1} | |
155 | %systemd_post corosync-qnetd.service | |
156 | %else | |
157 | if [ $1 -eq 1 ]; then | |
158 | /sbin/chkconfig --add corosync-qnetd || : | |
159 | fi | |
160 | %endif | |
161 | ||
162 | %preun -n corosync-qnetd | |
163 | %if %{with systemd} && 0%{?systemd_preun:1} | |
164 | %systemd_preun corosync-qnetd.service | |
165 | %else | |
166 | if [ $1 -eq 0 ]; then | |
167 | /sbin/service corosync-qnetd stop &>/dev/null || : | |
168 | /sbin/chkconfig --del corosync-qnetd || : | |
169 | fi | |
170 | %endif | |
171 | ||
172 | %postun -n corosync-qnetd | |
173 | %if %{with systemd} && 0%{?systemd_postun:1} | |
debef989 | 174 | %systemd_postun corosync-qnetd.service |
9a1955a7 JF |
175 | %endif |
176 | ||
177 | %files -n corosync-qnetd | |
9a1955a7 JF |
178 | %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd |
179 | %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd | |
180 | %{_bindir}/corosync-qnetd | |
181 | %{_bindir}/corosync-qnetd-certutil | |
182 | %{_bindir}/corosync-qnetd-tool | |
183 | %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd | |
184 | %if %{with systemd} | |
185 | %{_unitdir}/corosync-qnetd.service | |
186 | %else | |
187 | %{_initrddir}/corosync-qnetd | |
188 | %endif | |
189 | %{_mandir}/man8/corosync-qnetd-tool.8* | |
190 | %{_mandir}/man8/corosync-qnetd-certutil.8* | |
191 | %{_mandir}/man8/corosync-qnetd.8* | |
192 | ||
193 | %changelog | |
194 | * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@ | |
195 | - Autotools generated version |