postsrsd-vl.spec 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. %bcond_with systemd
  2. Name: postsrsd
  3. Version: 1.11
  4. Release: 1%{?_dist_release}%{?with_systemd:.systemd}
  5. Summary: Sender Rewriting Scheme (SRS) provider
  6. Group: servers
  7. Vendor: Project Vine
  8. Distribution: Vine Linux
  9. License: GPLv2+
  10. URL: https://github.com/roehling/postsrsd
  11. Source0: https://github.com/roehling/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
  12. Source1: postsrsd.conf
  13. Source2: postsrsd.init
  14. BuildRequires: gcc
  15. BuildRequires: cmake
  16. BuildRequires: help2man
  17. %if %{with systemd}
  18. %{?systemd_requires}
  19. %else
  20. Requires(post): /sbin/chkconfig
  21. Requires(preun): /sbin/chkconfig
  22. Requires(preun): /sbin/service
  23. Requires(postun): /sbin/service
  24. %endif
  25. Requires: postfix
  26. %description
  27. PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix.
  28. SRS is needed if your mail server acts as forwarder.
  29. %debug_package
  30. %prep
  31. %autosetup -n %{name}-%{version}
  32. %cmake \
  33. %if %{with systemd}
  34. -DINIT_FLAVOR=systemd \
  35. %else
  36. -DINIT_FLAVOR=sysv-redhat \
  37. %endif
  38. -DGENERATE_SRS_SECRET=OFF \
  39. -DUSE_SELINUX=OFF \
  40. %{nil}
  41. %build
  42. %cmake_build
  43. %install
  44. rm -rf %{buildroot}
  45. %cmake_install
  46. %if %{with systemd}
  47. mkdir -p %{buildroot}/%{_unitdir}
  48. mv -f %{buildroot}/%{_sysconfdir}/systemd/system/%{name}.service \
  49. %{buildroot}%{_unitdir}/
  50. mkdir -p %{buildroot}%{_tmpfilesdir}/
  51. install -m644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/
  52. %else
  53. rm -f %{buildroot}/%{_sysconfdir}/init.d/postsrsd
  54. mkdir -p %{buildroot}/%{_initdir}
  55. install -m755 %{SOURCE2} %{buildroot}%{_initdir}/postsrsd
  56. %endif
  57. # %%ghost file requires it is present in the build root
  58. touch %{buildroot}/%{_sysconfdir}/postsrsd.secret
  59. # chroot directory
  60. # (also move default config which is in the way)
  61. sed -i 's/^CHROOT=.*/CHROOT=\/run\/postsrsd/' %{buildroot}/%{_sysconfdir}/default/%{name}
  62. %files
  63. %license LICENSE
  64. %ghost %{_sysconfdir}/postsrsd.secret
  65. %config(noreplace) %{_sysconfdir}/default/%{name}
  66. %if %{with systemd}
  67. %{_datadir}/postsrsd/postsrsd-systemd-launcher
  68. %{_unitdir}/postsrsd.service
  69. %{_tmpfilesdir}/*
  70. %else
  71. %{_initdir}/postsrsd
  72. %exclude %{_datadir}/postsrsd/postsrsd-systemd-launcher
  73. %endif
  74. %{_sbindir}/postsrsd
  75. %{_docdir}/%{name}
  76. %{_mandir}/man8/postsrsd.8.gz
  77. %post
  78. [ -f %{_sysconfdir}/postsrsd.secret ] || dd if=/dev/urandom bs=18 count=1 2>/dev/null | base64 >%{_sysconfdir}/postsrsd.secret
  79. %if %{with systemd}
  80. %systemd_post %{name}.service
  81. %else
  82. /sbin/chkconfig --add postsrsd
  83. %endif
  84. %preun
  85. %if %{with systemd}
  86. %systemd_preun %{name}.service
  87. %else
  88. if [ $1 -eq 0 -o -x /bin/systemctl ]; then
  89. /sbin/service %{name} stop
  90. /sbin/chkconfig --del %{name}
  91. fi
  92. %endif
  93. %postun
  94. %if %{with systemd}
  95. %systemd_postun_with_restart %{name}.service
  96. %else
  97. if [ "$1" -ge "1" -a ! -x /bin/systemctl ]; then
  98. /sbin/service %{name} condrestart
  99. fi
  100. %endif
  101. %changelog
  102. * Wed Jul 07 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.11-1
  103. - new upstream release.
  104. * Wed Dec 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.10-1
  105. - new upstream release.
  106. * Sat Apr 18 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.6-2
  107. - made to create chroot directory at boot.
  108. * Thu Apr 09 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.6-1
  109. - new upstream release.
  110. - added systemd support (disabled as default).
  111. * Sat Jan 26 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.5-1
  112. - initial build for Vine Linux.
  113. - new upstream release.
  114. * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-11.20170118gita77bf99
  115. - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
  116. * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-10.20170118gita77bf99
  117. - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
  118. * Wed Oct 04 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-9.20170118gita77bf99
  119. - use the %%ghost feature to ensure the secret file is owned by the package
  120. - it is then not necessary to handle its removal in %%postun
  121. * Thu Sep 28 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-8.20170118gita77bf99
  122. - Thanks Matthias Runge Mauchin for the review
  123. - break description line too long
  124. - build dependency on gcc is not needed
  125. * Wed Sep 27 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-7.20170118gita77bf99
  126. - make the changelog more readable
  127. - stop recreating buildroot, it is made clean already
  128. * Wed Aug 23 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-6.20170118gita77bf99
  129. - remove unnecessary Requires on make
  130. - use _sysconfdir macro
  131. - use name macro when it makes sense
  132. - remove unnecessary %%doc as the buildsys already populates docdir
  133. * Tue Aug 22 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-5.20170118gita77bf99
  134. - remove %%clean section, not needed in Fedora
  135. * Tue Aug 22 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-4.20170118gita77bf99
  136. - don't remove secret file during upgrade
  137. - start service at the end of post scriptlet
  138. - improve SELinux rules handling (now requires a running SELinux)
  139. * Tue Aug 22 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-3.20170118gita77bf99
  140. - Thanks Robert-André Mauchin for the review
  141. - snapshot is packaged to get this necessary fix: https://github.com/roehling/postsrsd/pull/65
  142. - fixed version
  143. - fixed source URL
  144. - use macros for standard paths and build steps
  145. - add missing systemd scriptlets
  146. - specify doc and license files
  147. - remove unnecessary Requires on base64
  148. - remove Group information unsupported in Fedora
  149. * Fri Apr 14 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-2
  150. - create /etc/postsrsd.secret if missing
  151. - move systemd config into directory for packages
  152. - move chroot directory into /run
  153. - autocreate chroot directory
  154. * Thu Mar 30 2017 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-1
  155. - initial packaging