corosync-qdevice.spec.in 5.9 KB

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