corosync-qdevice.spec.in 5.4 KB

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