corosync-qdevice.spec.in 5.0 KB

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