corosync-qdevice.spec.in 5.0 KB

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