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