postsrsd-vl.spec 5.0 KB

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