corosync-qdevice.spec.in 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
  11. %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
  12. Name: corosync-qdevice
  13. Summary: The Corosync Cluster Engine Qdevice
  14. Version: @version@
  15. Release: 1%{?gitver}%{?dist}
  16. License: BSD
  17. URL: https://github.com/corosync/corosync-qdevice
  18. Source0: https://github.com/corosync/corosync-qdevice/releases/download/v%{version}%{?gittarver}/%{name}-%{version}%{?gittarver}.tar.gz
  19. # Runtime bits
  20. Requires: corosync >= 2.4.0
  21. Requires: corosynclib >= 2.4.0
  22. Requires: nss-tools
  23. %if %{with systemd}
  24. %{?systemd_requires}
  25. BuildRequires: systemd
  26. BuildRequires: systemd-devel
  27. %else
  28. Requires(post): /sbin/chkconfig
  29. Requires(preun): /sbin/chkconfig
  30. %endif
  31. # Build bits
  32. BuildRequires: gcc
  33. BuildRequires: corosynclib-devel
  34. BuildRequires: libqb-devel
  35. BuildRequires: sed
  36. %if 0%{?suse_version}
  37. BuildRequires: groff-full
  38. %else
  39. BuildRequires: groff
  40. %endif
  41. %if 0%{?suse_version}
  42. BuildRequires: mozilla-nss-devel
  43. %else
  44. BuildRequires: nss-devel
  45. %endif
  46. %if %{with runautogen}
  47. BuildRequires: autoconf automake libtool
  48. %endif
  49. %prep
  50. %setup -q -n %{name}-%{version}%{?gittarver}
  51. %build
  52. %if %{with runautogen}
  53. ./autogen.sh
  54. %endif
  55. %{configure} \
  56. %if %{with userflags}
  57. --enable-user-flags \
  58. %endif
  59. %if %{with systemd}
  60. --enable-systemd \
  61. %endif
  62. --enable-qdevices \
  63. --enable-qnetd \
  64. --with-initddir=%{_initrddir} \
  65. --with-systemddir=%{_unitdir} \
  66. --docdir=%{_docdir}
  67. make %{_smp_mflags}
  68. %install
  69. make install DESTDIR=%{buildroot}
  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 -p -m 644 init/corosync-qdevice.sysconfig.example \
  76. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
  77. # /etc/sysconfig/corosync-qnetd
  78. install -p -m 644 init/corosync-qnetd.sysconfig.example \
  79. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
  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. %description
  88. This package contains the Corosync Cluster Engine Qdevice, script for creating
  89. NSS certificates and an init script.
  90. %post
  91. %if %{with systemd} && 0%{?systemd_post:1}
  92. %systemd_post corosync-qdevice.service
  93. %else
  94. if [ $1 -eq 1 ]; then
  95. /sbin/chkconfig --add corosync-qdevice || :
  96. fi
  97. %endif
  98. %preun
  99. %if %{with systemd} && 0%{?systemd_preun:1}
  100. %systemd_preun corosync-qdevice.service
  101. %else
  102. if [ $1 -eq 0 ]; then
  103. /sbin/service corosync-qdevice stop &>/dev/null || :
  104. /sbin/chkconfig --del corosync-qdevice || :
  105. fi
  106. %endif
  107. %postun
  108. %if %{with systemd} && 0%{?systemd_postun:1}
  109. %systemd_postun corosync-qdevice.service
  110. %endif
  111. %files
  112. %license LICENSE
  113. %dir %{_sysconfdir}/corosync/qdevice
  114. %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
  115. %dir %{_localstatedir}/run/corosync-qdevice
  116. %{_sbindir}/corosync-qdevice
  117. %{_sbindir}/corosync-qdevice-net-certutil
  118. %{_sbindir}/corosync-qdevice-tool
  119. %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
  120. %if %{with systemd}
  121. %{_unitdir}/corosync-qdevice.service
  122. %else
  123. %{_initrddir}/corosync-qdevice
  124. %endif
  125. %{_mandir}/man8/corosync-qdevice-tool.8*
  126. %{_mandir}/man8/corosync-qdevice-net-certutil.8*
  127. %{_mandir}/man8/corosync-qdevice.8*
  128. %package -n corosync-qdevice-devel
  129. Summary: The Corosync Cluster Engine Qdevice Network Development Kit
  130. Requires: pkgconfig
  131. %description -n corosync-qdevice-devel
  132. This package contains files used to develop using
  133. The Corosync Cluster Engine Qdevice
  134. %files -n corosync-qdevice-devel
  135. %license LICENSE
  136. %{_datadir}/pkgconfig/corosync-qdevice.pc
  137. %package -n corosync-qnetd
  138. Summary: The Corosync Cluster Engine Qdevice Network Daemon
  139. Requires: nss-tools
  140. Requires(pre): shadow-utils
  141. %if %{with systemd}
  142. %{?systemd_requires}
  143. %endif
  144. %description -n corosync-qnetd
  145. This package contains the Corosync Cluster Engine Qdevice Network Daemon,
  146. script for creating NSS certificates and an init script.
  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. %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. %preun -n corosync-qnetd
  161. %if %{with systemd} && 0%{?systemd_preun:1}
  162. %systemd_preun corosync-qnetd.service
  163. %else
  164. if [ $1 -eq 0 ]; then
  165. /sbin/service corosync-qnetd stop &>/dev/null || :
  166. /sbin/chkconfig --del corosync-qnetd || :
  167. fi
  168. %endif
  169. %postun -n corosync-qnetd
  170. %if %{with systemd} && 0%{?systemd_postun:1}
  171. %systemd_postun corosync-qnetd.service
  172. %endif
  173. %files -n corosync-qnetd
  174. %license LICENSE
  175. %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
  176. %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
  177. %{_bindir}/corosync-qnetd
  178. %{_bindir}/corosync-qnetd-certutil
  179. %{_bindir}/corosync-qnetd-tool
  180. %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
  181. %if %{with systemd}
  182. %{_unitdir}/corosync-qnetd.service
  183. %else
  184. %{_initrddir}/corosync-qnetd
  185. %endif
  186. %{_mandir}/man8/corosync-qnetd-tool.8*
  187. %{_mandir}/man8/corosync-qnetd-certutil.8*
  188. %{_mandir}/man8/corosync-qnetd.8*
  189. %changelog
  190. * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
  191. - Autotools generated version