diff --git a/fetchmail.changes b/fetchmail.changes index 32aaeec..fec1f7c 100644 --- a/fetchmail.changes +++ b/fetchmail.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Apr 8 12:20:27 UTC 2016 - pjanouch@suse.de + +- Made /etc/sysconfig/fetchmail work again after a botched systemd + conversion that ignored the file altogether (bsc#905673) +- Removed the FETCHMAIL_USER setting in favor of editing the + systemd service file (which should be copied to the respective + location in /etc, and not edited in-place) + ------------------------------------------------------------------- Thu Jan 8 16:04:11 UTC 2015 - tchvatal@suse.com diff --git a/fetchmail.exec b/fetchmail.exec new file mode 100644 index 0000000..ca709d4 --- /dev/null +++ b/fetchmail.exec @@ -0,0 +1,21 @@ +#!/bin/sh +# fetchmail-systemd-exec: sysconfig helper script for systemd + +die() { + echo "$@" 1>&2 + exit 1 +} + +echo "$FETCHMAIL_POLLING_INTERVAL" | grep -Eq '^[0-9]+$' \ + || die 'invalid $FETCHMAIL_POLLING_INTERVAL setting' +[ -r "$FETCHMAIL_RC_PATH" ] \ + || die '$FETCHMAIL_RC_PATH does not exist' + +OPTS="-d $FETCHMAIL_POLLING_INTERVAL" +[ "$FETCHMAIL_FETCHALL" = "yes" ] && OPTS="$OPTS -a" +[ "$FETCHMAIL_SILENT" = "yes" ] && OPTS="$OPTS -s" +[ "`whoami`" = "fetchmail" -a -z "$FETCHMAILHOME" ] && \ + export FETCHMAILHOME=/var/lib/fetchmail + +exec /usr/bin/fetchmail $OPTS $FETCHMAIL_EXPERT_OPTIONS \ + -f $FETCHMAIL_RC_PATH -L /var/log/fetchmail diff --git a/fetchmail.service b/fetchmail.service index 1bc85fa..b81f557 100644 --- a/fetchmail.service +++ b/fetchmail.service @@ -3,8 +3,9 @@ Description=A remote-mail retrieval utility After=network.target [Service] +EnvironmentFile=-/etc/sysconfig/fetchmail User=fetchmail -ExecStart=/usr/bin/fetchmail -d 900 -f /etc/fetchmailrc +ExecStart=/usr/lib/fetchmail-systemd-exec RestartSec=1 [Install] diff --git a/fetchmail.spec b/fetchmail.spec index a3b46ca..567d0d7 100644 --- a/fetchmail.spec +++ b/fetchmail.spec @@ -1,7 +1,7 @@ # # spec file for package fetchmail # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -30,6 +30,7 @@ Source4: http://sourceforge.net/projects/fetchmail/files/branch_6.3/%{nam Source5: %{name}.keyring Source6: %{name}.service Source7: %{name}.tmpfiles +Source8: %{name}.exec Patch0: fetchmail-6.3.8-smtp_errors.patch BuildRequires: automake BuildRequires: krb5-devel @@ -40,13 +41,13 @@ BuildRequires: procmail BuildRequires: pwdutils BuildRequires: python-devel BuildRequires: xz +BuildRequires: pkgconfig(systemd) Requires: logrotate Requires(pre): %fillup_prereq Requires(pre): coreutils Requires(pre): pwdutils Suggests: smtp_daemon BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: pkgconfig(systemd) %{?systemd_requires} %description @@ -88,7 +89,7 @@ export CFLAGS="%{optflags} -fPIE" --enable-opie \ --with-kerberos5 \ --with-gssapi \ - --with-ssl=/usr + --with-ssl=%{_prefix} make %{?_smp_mflags} LDFLAGS="-pie" %install @@ -101,6 +102,7 @@ mkdir -p %{buildroot}/%{_unitdir} mkdir -p %{buildroot}/%{_libexecdir}/tmpfiles.d install -m 0644 %{SOURCE6} %{buildroot}/%{_unitdir}/%{name}.service install -m 0644 %{SOURCE7} %{buildroot}/%{_libexecdir}/tmpfiles.d/%{name}.conf +install -m 0755 %{SOURCE8} %{buildroot}/%{_libexecdir}/%{name}-systemd-exec mkdir -p %{buildroot}%{_sbindir} ln -s service %{buildroot}%{_sbindir}/rc%{name} touch %{buildroot}%{_sysconfdir}/fetchmailrc @@ -141,19 +143,20 @@ fi %{_bindir}/fetchmail %dir %attr(0700, fetchmail, root) %{_localstatedir}/lib/fetchmail %ghost %attr(0600, fetchmail, root) %{_localstatedir}/log/fetchmail -%doc %{_mandir}/man1/fetchmail.1.gz +%{_mandir}/man1/fetchmail.1.gz %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 %{_unitdir}/%{name}.service %{_sbindir}/rc%{name} +%{_libexecdir}/%{name}-systemd-exec %{_libexecdir}/tmpfiles.d/%{name}.conf %{_localstatedir}/adm/fillup-templates/sysconfig.%{name} %files -n fetchmailconf %defattr(-, root, root) %{_bindir}/fetchmailconf -%doc %{_mandir}/man1/fetchmailconf.1.gz +%{_mandir}/man1/fetchmailconf.1.gz %{python_sitelib}/fetchmailconf.* %changelog diff --git a/sysconfig.fetchmail b/sysconfig.fetchmail index 0979a36..f49809c 100644 --- a/sysconfig.fetchmail +++ b/sysconfig.fetchmail @@ -27,15 +27,6 @@ FETCHMAIL_FETCHALL="yes" # FETCHMAIL_SILENT="no" -## Type: list(fetchmail,root) -## Default: fetchmail -# -# Fetchmail runs by default as a non-root user. This is more secure, but -# can cause problems when using delivery via MDA. In this case, change -# it to "root". -# -FETCHMAIL_USER="fetchmail" - ## Type: string ## Default: "" #