corosync-qdevice.spec.in 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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_runautogen@ runautogen
  8. %@bcond_systemd@ 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. URL: https://github.com/corosync/corosync-qdevice
  17. Source0: https://github.com/corosync/corosync-qdevice/releases/download/v%{version}%{?gittarver}/%{name}-%{version}%{?gittarver}.tar.gz
  18. # Runtime bits
  19. Requires: corosync >= 2.4.0
  20. Requires: corosynclib >= 2.4.0
  21. Requires: nss-tools
  22. %if %{with systemd}
  23. %{?systemd_requires}
  24. BuildRequires: systemd
  25. BuildRequires: systemd-devel
  26. %else
  27. Requires(post): /sbin/chkconfig
  28. Requires(preun): /sbin/chkconfig
  29. %endif
  30. # Build bits
  31. BuildRequires: gcc
  32. BuildRequires: corosynclib-devel
  33. BuildRequires: libqb-devel
  34. BuildRequires: sed
  35. %if 0%{?suse_version}
  36. BuildRequires: groff-full
  37. %else
  38. BuildRequires: groff
  39. %endif
  40. %if 0%{?suse_version}
  41. BuildRequires: mozilla-nss-devel
  42. %else
  43. BuildRequires: nss-devel
  44. %endif
  45. %if %{with runautogen}
  46. BuildRequires: autoconf automake libtool
  47. %endif
  48. %prep
  49. %setup -q -n %{name}-%{version}%{?gittarver}
  50. %build
  51. %if %{with runautogen}
  52. ./autogen.sh
  53. %endif
  54. %{configure} \
  55. %if %{with systemd}
  56. --enable-systemd \
  57. %endif
  58. --enable-qdevices \
  59. --enable-qnetd \
  60. --with-initddir=%{_initrddir} \
  61. --with-systemddir=%{_unitdir} \
  62. --docdir=%{_docdir}
  63. make %{_smp_mflags}
  64. %install
  65. make install DESTDIR=%{buildroot}
  66. ## tree fixup
  67. # drop docs and html docs for now
  68. rm -rf %{buildroot}%{_docdir}/*
  69. mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
  70. # /etc/sysconfig/corosync-qdevice
  71. install -m 644 init/corosync-qdevice.sysconfig.example \
  72. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
  73. # /etc/sysconfig/corosync-qnetd
  74. install -m 644 init/corosync-qnetd.sysconfig.example \
  75. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
  76. %if %{with systemd}
  77. sed -i -e 's/^#User=/User=/' \
  78. %{buildroot}%{_unitdir}/corosync-qnetd.service
  79. %else
  80. sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
  81. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
  82. %endif
  83. %description
  84. This package contains the Corosync Cluster Engine Qdevice, script for creating
  85. NSS certificates and an init script.
  86. %post
  87. %if %{with systemd} && 0%{?systemd_post:1}
  88. %systemd_post corosync-qdevice.service
  89. %else
  90. if [ $1 -eq 1 ]; then
  91. /sbin/chkconfig --add corosync-qdevice || :
  92. fi
  93. %endif
  94. %preun
  95. %if %{with systemd} && 0%{?systemd_preun:1}
  96. %systemd_preun corosync-qdevice.service
  97. %else
  98. if [ $1 -eq 0 ]; then
  99. /sbin/service corosync-qdevice stop &>/dev/null || :
  100. /sbin/chkconfig --del corosync-qdevice || :
  101. fi
  102. %endif
  103. %postun
  104. %if %{with systemd} && 0%{?systemd_postun:1}
  105. %systemd_postun corosync-qdevice.service
  106. %endif
  107. %files
  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. Requires: nss-tools
  126. Requires(pre): shadow-utils
  127. %if %{with systemd}
  128. %{?systemd_requires}
  129. %endif
  130. %description -n corosync-qnetd
  131. This package contains the Corosync Cluster Engine Qdevice Network Daemon,
  132. script for creating NSS certificates and an init script.
  133. %pre -n corosync-qnetd
  134. getent group coroqnetd >/dev/null || groupadd -r coroqnetd
  135. getent passwd coroqnetd >/dev/null || \
  136. useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
  137. exit 0
  138. %post -n corosync-qnetd
  139. %if %{with systemd} && 0%{?systemd_post:1}
  140. %systemd_post corosync-qnetd.service
  141. %else
  142. if [ $1 -eq 1 ]; then
  143. /sbin/chkconfig --add corosync-qnetd || :
  144. fi
  145. %endif
  146. %preun -n corosync-qnetd
  147. %if %{with systemd} && 0%{?systemd_preun:1}
  148. %systemd_preun corosync-qnetd.service
  149. %else
  150. if [ $1 -eq 0 ]; then
  151. /sbin/service corosync-qnetd stop &>/dev/null || :
  152. /sbin/chkconfig --del corosync-qnetd || :
  153. fi
  154. %endif
  155. %postun -n corosync-qnetd
  156. %if %{with systemd} && 0%{?systemd_postun:1}
  157. %systemd_postun corosync-qnetd.service
  158. %endif
  159. %files -n corosync-qnetd
  160. %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
  161. %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
  162. %{_bindir}/corosync-qnetd
  163. %{_bindir}/corosync-qnetd-certutil
  164. %{_bindir}/corosync-qnetd-tool
  165. %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
  166. %if %{with systemd}
  167. %{_unitdir}/corosync-qnetd.service
  168. %else
  169. %{_initrddir}/corosync-qnetd
  170. %endif
  171. %{_mandir}/man8/corosync-qnetd-tool.8*
  172. %{_mandir}/man8/corosync-qnetd-certutil.8*
  173. %{_mandir}/man8/corosync-qnetd.8*
  174. %changelog
  175. * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
  176. - Autotools generated version