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