GNU bug report logs - #35619
WIP version of postfix.scm

Previous Next

Package: guix-patches;

Reported by: "Brant Gardner" <brantcgardner <at> brantware.com>

Date: Tue, 7 May 2019 15:17:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org>
To: Gábor Boskovits <boskovits <at> gmail.com>, 35619 <at> debbugs.gnu.org
Subject: [bug#35619] [PATCH 4/5] service: postfix: Use mail-aliases-service-type.
Date: Mon, 10 Aug 2020 08:51:11 +0200
* gnu/services/mail.scm (postfix-service-type): Extend mail-aliases-service-type.
(postfix-shepherd-service): Generate /etc/aliases.db if necessary.
---
 gnu/services/mail.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 59cb373fbf..9a0066d920 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2019 Kristofer Buffington <kristoferbuffington <at> gmail.com>
 ;;; Copyright © 2020 Gábor Boskovits <boskovits <at> gmail.com>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1956,9 +1957,17 @@ inet_protocols = ipv4
   (match-record config <postfix-configuration>
     (postfix)
     (let* ((postfix-binary (file-append postfix "/postfix"))
+           (postalias-binary (file-append postfix "/postalias"))
            (postfix-action
             (lambda (action)
               #~(lambda _
+                  (when (or (not (file-exists? "/etc/aliases.db"))
+                            (> (stat:mtime (stat "/etc/aliases"))
+                               (stat:mtime (stat "/etc/aliases.db"))))
+                    (invoke #$postalias-binary
+                            "-c"
+                            #$(postfix-configuration-directory config)
+                            "/etc/aliases"))
                   (invoke #$postfix-binary "-c"
                           #$(postfix-configuration-directory config)
                           #$action)))))
@@ -1974,6 +1983,7 @@ inet_protocols = ipv4
    (name 'postfix)
    (extensions (list (service-extension account-service-type postfix-accounts)
                      (service-extension activation-service-type postfix-activation)
-                     (service-extension shepherd-root-service-type postfix-shepherd-service)))
+                     (service-extension shepherd-root-service-type postfix-shepherd-service)
+                     (service-extension mail-aliases-service-type (const '()))))
    (description "Run the Postfix MTA.")
    (default-value (postfix-configuration))))
-- 
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com





This bug report was last modified 1 year and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.