postsrsd-vl.spec 5.3 KB

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