git: 145c527f0c73 - main - mail/fetchmail: fix restart with "service -R"

From: Bernard Spil <brnrd_at_FreeBSD.org>
Date: Sun, 24 Oct 2021 07:59:45 UTC
The branch main has been updated by brnrd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=145c527f0c730ec3617b220cd3ff27d0af9139ad

commit 145c527f0c730ec3617b220cd3ff27d0af9139ad
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2021-10-24 07:56:29 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2021-10-24 07:56:29 +0000

    mail/fetchmail: fix restart with "service -R"
    
    PR:             258207
    Approved by:    chalpin cs wisc edu (maintainer)
---
 mail/fetchmail/Makefile           | 1 +
 mail/fetchmail/files/fetchmail.in | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/mail/fetchmail/Makefile b/mail/fetchmail/Makefile
index 0ed21d352bcf..21a0b7561e00 100644
--- a/mail/fetchmail/Makefile
+++ b/mail/fetchmail/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME?=	fetchmail
 DISTVERSION=	6.4.22
+PORTREVISION=	1
 CATEGORIES=	mail
 # The next line is inherited by the fetchmailconf dependent port,
 # do NOT replace fetchmail by ${PORTNAME}
diff --git a/mail/fetchmail/files/fetchmail.in b/mail/fetchmail/files/fetchmail.in
index 208e4526a6b2..99756ee8c540 100644
--- a/mail/fetchmail/files/fetchmail.in
+++ b/mail/fetchmail/files/fetchmail.in
@@ -164,10 +164,14 @@ if [ "x${fetchmail_users}" != "x" ]; then
  		eval fetchmail_${i}="\${${uvarname}-\${fetchmail_${i}}}"
 	done
 else
-	pidfile=/var/run/fetchmail/fetchmail.pid
+	fetchmail_home=/var/run/fetchmail
 fi
 required_files=${fetchmail_config}
 
+# set up environment
+export FETCHMAILHOME=${fetchmail_home}
+export FETCHMAILUSER=${fetchmail_user}
+
 # add early command line arguments
 # if logfile set in config file, do not override with rc.conf default (note logfile overrides syslog)
 _logfile="$(fetchmail_dump_config logfile)"
@@ -184,5 +188,4 @@ if [ "$(fetchmail_dump_config poll_interval)" = "0," ] ; then
 fi
 
 # actually execute the fetchmail program
-export FETCHMAILUSER=$fetchmail_user
 run_rc_command "$1"