unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: 48751@debbugs.gnu.org
Cc: Arun Isaac <arunisaac@systemreboot.net>
Subject: [bug#48751] [PATCH] services: laminar: Create parent directory for unix socket.
Date: Mon, 31 May 2021 01:35:27 +0530	[thread overview]
Message-ID: <20210530200527.23041-1-arunisaac@systemreboot.net> (raw)
In-Reply-To: <20210530195952.22708-1-arunisaac@systemreboot.net>

* gnu/services/ci.scm (laminar-activation): New function.
(laminar-service-type): Extend activation-service-type with
laminar-activation.
---
 gnu/services/ci.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/services/ci.scm b/gnu/services/ci.scm
index 0b18521e76..0c3566bcaf 100644
--- a/gnu/services/ci.scm
+++ b/gnu/services/ci.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2019, 2020, 2021 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -115,13 +116,25 @@
          (home-directory (laminar-configuration-home-directory config))
          (shell #~(string-append #$shadow "/sbin/nologin")))))
 
+(define (laminar-activation config)
+  (let ((bind-http (laminar-configuration-bind-http config)))
+    #~(begin
+        ;; If listen is a unix socket, create its parent directory.
+        (when (string-prefix? "unix:" #$bind-http)
+          (let ((run-directory
+                 (dirname (substring #$bind-http (string-length "unix:"))))
+                (user (getpw "laminar")))
+            (mkdir-p run-directory)
+            (chown run-directory (passwd:uid user) (passwd:gid user)))))))
+
 (define laminar-service-type
   (service-type
    (name 'laminar)
    (extensions
     (list
      (service-extension shepherd-root-service-type laminar-shepherd-service)
-     (service-extension account-service-type laminar-account)))
+     (service-extension account-service-type laminar-account)
+     (service-extension activation-service-type laminar-activation)))
    (default-value (laminar-configuration))
    (description
     "Run the Laminar continuous integration service.")))
-- 
2.31.0





  reply	other threads:[~2021-05-30 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30 19:59 [bug#48751] [PATCH 0/1] Create parent directory for laminar unix socket Arun Isaac
2021-05-30 20:05 ` Arun Isaac [this message]
2021-06-08 15:35   ` [bug#48751] [PATCH] services: laminar: Create parent directory for " Christopher Baines
2021-06-10  5:00     ` bug#48751: " Arun Isaac
2021-06-16  7:31       ` [bug#48751] " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210530200527.23041-1-arunisaac@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=48751@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).