postsrsd-vl.spec 5.6 KB

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