gnu: opensmtpd: Use G-expressions.

* gnu/packages/mail.scm (opensmtpd)[arguments]<#:phases>: Use G-expressions.

Reviewed-by: 宋文武 <iyzsong@envs.net>
Change-Id: I97dce2865e2b67f0f7cd4f10b0b6cc10a459ceb7
This commit is contained in:
Zheng Junjie 2025-02-06 22:48:19 +08:00
parent 169ef7616b
commit 314cacc358
No known key found for this signature in database
GPG key ID: 3B5AA993E1A2DFF0

View file

@ -3338,44 +3338,43 @@ from the Cyrus IMAP project.")
(string-append "ac_cv_path_ZCAT="
#$(this-package-input "gzip") "/bin/zcat"))
#:phases
`(modify-phases %standard-phases
;; Fix some incorrectly hard-coded external tool file names.
(add-after 'unpack 'patch-FHS-file-names
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "mk/pathnames"
;; avoids warning smtpd: couldn't enqueue offline message
;; smtpctl exited abnormally
(("(-DPATH_SMTPCTL=).*\\\\" all def)
(string-append def "\\\"/run/privileged/bin/smtpctl\\\" \\"))
(("(-DPATH_MAKEMAP=).*\\\\" all def)
(string-append def "\\\"/run/privileged/bin/makemap\\\" \\")))
(substitute* "usr.sbin/smtpd/smtpctl.c"
;; gzcat is auto-detected at compile time, but cat isn't.
(("/bin/cat" file) (search-input-file inputs file)))
(substitute* "usr.sbin/smtpd/mda_unpriv.c"
(("/bin/sh" file) (search-input-file inputs file)))))
;; Avoid install smtpd.conf to /etc.
(add-after 'unpack 'fix-smtpd.conf-install-path
(lambda _
(let ((etc (string-append (assoc-ref %outputs "out")
"/etc")))
(mkdir-p etc)
(substitute* "mk/smtpd/Makefile.am"
(("\\$\\(DESTDIR\\)\\$\\(sysconfdir\\)/smtpd\\.conf")
(string-append etc "/smtpd.conf"))))))
;; OpenSMTPD provides a single smtpctl utility to control both the
;; daemon and the local submission subsystem. To accomodate systems
;; that require historical interfaces such as sendmail, newaliases or
;; makemap, smtpctl operates in compatibility mode if called with the
;; historical name.
(add-after 'install 'install-compability-links
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(sbin (string-append out "/sbin/")))
(for-each (lambda (command)
(symlink "smtpctl" (string-append sbin command)))
(list "mailq" "makemap" "newaliases"
"send-mail" "sendmail"))))))))
#~(modify-phases %standard-phases
;; Fix some incorrectly hard-coded external tool file names.
(add-after 'unpack 'patch-FHS-file-names
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "mk/pathnames"
;; avoids warning smtpd: couldn't enqueue offline message
;; smtpctl exited abnormally
(("(-DPATH_SMTPCTL=).*\\\\" all def)
(string-append def "\\\"/run/privileged/bin/smtpctl\\\" \\"))
(("(-DPATH_MAKEMAP=).*\\\\" all def)
(string-append def "\\\"/run/privileged/bin/makemap\\\" \\")))
(substitute* "usr.sbin/smtpd/smtpctl.c"
;; gzcat is auto-detected at compile time, but cat isn't.
(("/bin/cat" file) (search-input-file inputs file)))
(substitute* "usr.sbin/smtpd/mda_unpriv.c"
(("/bin/sh" file) (search-input-file inputs file)))))
;; Avoid install smtpd.conf to /etc.
(add-after 'unpack 'fix-smtpd.conf-install-path
(lambda _
(let ((etc (string-append #$output "/etc")))
(mkdir-p etc)
(substitute* "mk/smtpd/Makefile.am"
(("\\$\\(DESTDIR\\)\\$\\(sysconfdir\\)/smtpd\\.conf")
(string-append etc "/smtpd.conf"))))))
;; OpenSMTPD provides a single smtpctl utility to control both the
;; daemon and the local submission subsystem. To accomodate systems
;; that require historical interfaces such as sendmail, newaliases or
;; makemap, smtpctl operates in compatibility mode if called with the
;; historical name.
(add-after 'install 'install-compability-links
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(sbin (string-append out "/sbin/")))
(for-each (lambda (command)
(symlink "smtpctl" (string-append sbin command)))
(list "mailq" "makemap" "newaliases"
"send-mail" "sendmail"))))))))
(synopsis "Lightweight SMTP daemon")
(description
"OpenSMTPD is an implementation of server-side @acronym{SMTP, Simple Mail