corosync-qdevice.spec.in 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. 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. make %{_smp_mflags}
  63. %install
  64. make install DESTDIR=%{buildroot}
  65. ## tree fixup
  66. # drop docs and html docs for now
  67. rm -rf %{buildroot}%{_docdir}/*
  68. mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
  69. # /etc/sysconfig/corosync-qdevice
  70. install -m 644 init/corosync-qdevice.sysconfig.example \
  71. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
  72. # /etc/sysconfig/corosync-qnetd
  73. install -m 644 init/corosync-qnetd.sysconfig.example \
  74. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
  75. %if %{with systemd}
  76. sed -i -e 's/^#User=/User=/' \
  77. %{buildroot}%{_unitdir}/corosync-qnetd.service
  78. %else
  79. sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
  80. %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
  81. %endif
  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 corosync-qdevice.service
  105. %endif
  106. %files
  107. %dir %{_sysconfdir}/corosync/qdevice
  108. %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
  109. %dir %{_localstatedir}/run/corosync-qdevice
  110. %{_sbindir}/corosync-qdevice
  111. %{_sbindir}/corosync-qdevice-net-certutil
  112. %{_sbindir}/corosync-qdevice-tool
  113. %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
  114. %if %{with systemd}
  115. %{_unitdir}/corosync-qdevice.service
  116. %else
  117. %{_initrddir}/corosync-qdevice
  118. %endif
  119. %{_mandir}/man8/corosync-qdevice-tool.8*
  120. %{_mandir}/man8/corosync-qdevice-net-certutil.8*
  121. %{_mandir}/man8/corosync-qdevice.8*
  122. %package -n corosync-qnetd
  123. Summary: The Corosync Cluster Engine Qdevice Network Daemon
  124. Requires: nss-tools
  125. Requires(pre): shadow-utils
  126. %if %{with systemd}
  127. %{?systemd_requires}
  128. %endif
  129. %description -n corosync-qnetd
  130. This package contains the Corosync Cluster Engine Qdevice Network Daemon,
  131. script for creating NSS certificates and an init script.
  132. %pre -n corosync-qnetd
  133. getent group coroqnetd >/dev/null || groupadd -r coroqnetd
  134. getent passwd coroqnetd >/dev/null || \
  135. useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
  136. exit 0
  137. %post -n corosync-qnetd
  138. %if %{with systemd} && 0%{?systemd_post:1}
  139. %systemd_post corosync-qnetd.service
  140. %else
  141. if [ $1 -eq 1 ]; then
  142. /sbin/chkconfig --add corosync-qnetd || :
  143. fi
  144. %endif
  145. %preun -n corosync-qnetd
  146. %if %{with systemd} && 0%{?systemd_preun:1}
  147. %systemd_preun corosync-qnetd.service
  148. %else
  149. if [ $1 -eq 0 ]; then
  150. /sbin/service corosync-qnetd stop &>/dev/null || :
  151. /sbin/chkconfig --del corosync-qnetd || :
  152. fi
  153. %endif
  154. %postun -n corosync-qnetd
  155. %if %{with systemd} && 0%{?systemd_postun:1}
  156. %systemd_postun corosync-qnetd.service
  157. %endif
  158. %files -n corosync-qnetd
  159. %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
  160. %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
  161. %{_bindir}/corosync-qnetd
  162. %{_bindir}/corosync-qnetd-certutil
  163. %{_bindir}/corosync-qnetd-tool
  164. %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
  165. %if %{with systemd}
  166. %{_unitdir}/corosync-qnetd.service
  167. %else
  168. %{_initrddir}/corosync-qnetd
  169. %endif
  170. %{_mandir}/man8/corosync-qnetd-tool.8*
  171. %{_mandir}/man8/corosync-qnetd-certutil.8*
  172. %{_mandir}/man8/corosync-qnetd.8*
  173. %changelog
  174. * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
  175. - Autotools generated version