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