aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-16 09:42:12 -0300
committerEuAndreh <eu@euandre.org>2023-03-16 09:42:12 -0300
commit616b0d55783b1c9bf1c5a9438ac929c9a48e3aa4 (patch)
tree64bd19c0f8a03ec1bebbc3c597c3255d9691b6da
parentqueue.scm: Add extra separation before "mailutils-sendmail" package (diff)
downloadpackage-repository-616b0d55783b1c9bf1c5a9438ac929c9a48e3aa4.tar.gz
package-repository-616b0d55783b1c9bf1c5a9438ac929c9a48e3aa4.tar.xz
queue.scm: Use mkdir-p/perms vs mkdir-p+chown+chmod
-rw-r--r--src/org/euandre/queue.scm28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/org/euandre/queue.scm b/src/org/euandre/queue.scm
index edc6de3..3fe4db2 100644
--- a/src/org/euandre/queue.scm
+++ b/src/org/euandre/queue.scm
@@ -516,12 +516,9 @@ collections.OrderedDict that works in Python 2.4-2.6.")
(user run-directory)
#~(begin
(use-modules (guix build utils))
- (let ((user (getpwnam #$user)))
- (format (current-error-port)
- "Creating Cyrus SASL socket directory: \"~a\".~%" #$run-directory)
- (mkdir-p #$run-directory)
- (chown #$run-directory (passwd:uid user) (passwd:gid user))
- (chmod #$run-directory #o755)))))
+ (format (current-error-port)
+ "Creating Cyrus SASL socket directory: \"~a\".~%" #$run-directory)
+ (mkdir-p/perms #$run-directory (getpwnam #$user) #o755))))
(define (cyrus-sasl-accounts config)
(match-record config <cyrus-sasl-configuration>
@@ -688,13 +685,12 @@ keyfile ~a/private.key
(user group data-directory key-size)
#~(begin
(use-modules (guix build utils))
- (let ((uid (passwd:uid (getpwnam #$user)))
- (gid (group:gid (getgrnam #$group))))
+ (let* ((user (getpwnam #$user))
+ (uid (passwd:uid user))
+ (gid (passwd:gid user)))
(format (current-error-port)
"Creating DKIMproxy.out data directory: \"~a\".~%" #$data-directory)
- (mkdir-p #$data-directory)
- (chown #$data-directory uid gid)
- (chmod #$data-directory #o755)
+ (mkdir-p/perms #$data-directory user #o755)
(let ((private-key (string-append #$data-directory "/private.key"))
(public-key (string-append #$data-directory "/public.key")))
(unless (file-exists? private-key)
@@ -1024,12 +1020,10 @@ milter_default_action = accept
(let ((user (getpwnam "root")))
(format (current-error-port)
"Creating Postfix queue directory: \"~a\".~%" #$queue-directory)
- (mkdir-p #$queue-directory)
- (chown #$queue-directory (passwd:uid user) (passwd:gid user))
- (chmod #$queue-directory #o755)
+ (mkdir-p/perms #$queue-directory user #o755)
(format (current-error-port)
"Creating email spool director: \"/var/mail\".~%")
- (mkdir-p "/var/mail")
+ (mkdir-p/perms "/var/mail" user #o755)
(format (current-error-port)
"Updating /etc/aliases: FIXME.~%")
;; FIXME: add -c option
@@ -1355,9 +1349,9 @@ namespace inbox {
(let ((user (getpwnam "root")))
(format (current-error-port)
"Creating Dovecot base_dir directory: \"~a\".~%" #$base-dir)
- (mkdir-p #$base-dir)
+ (mkdir-p/perms #$base-dir user #o755)
(let ((dhparam.pem (string-append #$state-dir "/dhparam.pem")))
- (mkdir-p #$state-dir)
+ (mkdir-p/perms #$state-dir user #o755)
(unless (file-exists? dhparam.pem)
(format (current-error-port)
"dhparam.pem file doesn't exist yet. Generating one...~%")