SHA256
1
0
forked from pool/fetchmail

Accepting request 204925 from home:posophe:branches:server:mail

- Add systemd support for openSUSE >= 12.3

OBS-URL: https://build.opensuse.org/request/show/204925
OBS-URL: https://build.opensuse.org/package/show/server:mail/fetchmail?expand=0&rev=52
This commit is contained in:
Dr. Werner Fink 2013-11-10 10:08:03 +00:00 committed by Git OBS Bridge
parent 8d7fe5fc04
commit 992c58140e
4 changed files with 50 additions and 10 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sun Oct 27 18:18:54 UTC 2013 - p.drouand@gmail.com
- Add systemd support for openSUSE >= 12.3
-------------------------------------------------------------------
Mon Apr 29 12:45:09 UTC 2013 - vcizek@suse.com

11
fetchmail.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=A remote-mail retrieval utility
After=network.target
[Service]
User=fetchmail
ExecStart=/usr/bin/fetchmail -d 900 -f /etc/fetchmailrc
RestartSec=1
[Install]
WantedBy=multi-user.target

View File

@ -24,12 +24,7 @@ BuildRequires: postfix
BuildRequires: procmail
BuildRequires: pwdutils
BuildRequires: python-devel
%if 0%{?suse_version} > 1000
%define with_krb5 1
%endif
%if 0%{?with_krb5}
BuildRequires: krb5-devel
%endif
%if 0%{?suse_version} > 1220
BuildRequires: gpg-offline
%endif
@ -48,11 +43,18 @@ Source2: %{name}.logrotate
Source3: sysconfig.%{name}
Source4: http://sourceforge.net/projects/fetchmail/files/branch_6.3/%{name}-%{version}.tar.xz.asc
Source5: %{name}.keyring
Source6: %{name}.service
Source7: %{name}.tmpfiles
Patch0: fetchmail-6.3.8-smtp_errors.patch
PreReq: %fillup_prereq
PreReq: %insserv_prereq
PreReq: coreutils
PreReq: pwdutils
%if 0%{?suse_version} >=1230
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%else
Requires(pre): %insserv_prereq
%endif
Requires(pre): %fillup_prereq
Requires(pre): coreutils
Requires(pre): pwdutils
BuildRequires: xz
Requires: logrotate
Suggests: smtp_daemon
@ -116,11 +118,18 @@ make %{?_smp_mflags}
ln -sf fetchmail.1.gz %{buildroot}/%{_mandir}/man1/fetchmailconf.1.gz
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
cp fetchmail.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/fetchmail
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}/sbin
%if 0%{?suse_version} >=1230
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/tmpfiles.d
install -m 755 %{S:6} $RPM_BUILD_ROOT/%{_unitdir}/%{name}.service
install -m 644 %{S:7} $RPM_BUILD_ROOT/%{_libexecdir}/tmpfiles.d/%{name}.conf
%else
mkdir -p %{buildroot}%{_sysconfdir}/init.d
cp fetchmail.init %{buildroot}%{_initddir}/fetchmail
chmod +x %{buildroot}%{_initddir}/fetchmail
ln -s ../etc/init.d/fetchmail %{buildroot}/sbin/rcfetchmail
%endif
touch %{buildroot}%{_sysconfdir}/fetchmailrc
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
cp sysconfig.%{name} %{buildroot}%{_localstatedir}/adm/fillup-templates
@ -137,14 +146,23 @@ usr/sbin/useradd -r -g daemon -s /bin/false \
-c "mail retrieval daemon" -d /var/lib/fetchmail fetchmail 2>/dev/null || :
%post
%if 0%{?suse_version} >=1230
%{fillup_only}
%service_add_post %{name}.service
%else
%{fillup_and_insserv}
%endif
# Ensure that all files are readable by fetchmail with non-root UID.
touch var/log/fetchmail
chown fetchmail var/log/fetchmail
chmod 0600 var/log/fetchmail
%postun
%if 0%{?suse_version} >=1230
%service_del_postun %{name}.service
%else
%{insserv_cleanup}
%endif
if [ $1 == 0 ]; then
rm -rf var/lib/fetchmail
fi
@ -158,8 +176,13 @@ fi
%doc COPYING FAQ FEATURES NEWS NOTES OLDNEWS README README.NTLM README.SSL README.SSL-SERVER TODO contrib *.html *.txt *.pdf
%ghost %config(noreplace) %attr(0600, fetchmail, root) %{_sysconfdir}/fetchmailrc
%config(noreplace) %{_sysconfdir}/logrotate.d/fetchmail
%if 0%{?suse_version} >=1230
%{_unitdir}/%{name}.service
%{_libexecdir}/tmpfiles.d/%{name}.conf
%else
%{_sysconfdir}/init.d/fetchmail
/sbin/rcfetchmail
%endif
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%files -n fetchmailconf

1
fetchmail.tmpfiles Normal file
View File

@ -0,0 +1 @@
d /run/fetchmail 700 fetchmail nobody