From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id OBPEDh9ywV55fAAA0tVLHw (envelope-from ) for ; Sun, 17 May 2020 17:19:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id YMGwCh9ywV4oBgAAB5/wlQ (envelope-from ) for ; Sun, 17 May 2020 17:19:27 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E7A9D940429 for ; Sun, 17 May 2020 17:19:26 +0000 (UTC) Received: from localhost ([::1]:41334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaMwf-0000CI-QL for larch@yhetil.org; Sun, 17 May 2020 13:19:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaMwN-0008FY-00 for guix-patches@gnu.org; Sun, 17 May 2020 13:19:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaMwL-0004Lq-NC for guix-patches@gnu.org; Sun, 17 May 2020 13:19:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jaMwK-00079n-UM for guix-patches@gnu.org; Sun, 17 May 2020 13:19:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40601] [PATCH 05/28] guix-install.sh, guix-binary tarball: Handle runit-based foreign distributions. Resent-From: Vincent Legoll Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 17 May 2020 17:19:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40601 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40601@debbugs.gnu.org Cc: Vincent Legoll Received: via spool by 40601-submit@debbugs.gnu.org id=B40601.158973589527301 (code B ref 40601); Sun, 17 May 2020 17:19:04 +0000 Received: (at 40601) by debbugs.gnu.org; 17 May 2020 17:18:15 +0000 Received: from localhost ([127.0.0.1]:44578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaMvP-00075S-VV for submit@debbugs.gnu.org; Sun, 17 May 2020 13:18:15 -0400 Received: from mail-wm1-f41.google.com ([209.85.128.41]:36983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaMv9-00071F-MA for 40601@debbugs.gnu.org; Sun, 17 May 2020 13:17:55 -0400 Received: by mail-wm1-f41.google.com with SMTP id z72so7778509wmc.2 for <40601@debbugs.gnu.org>; Sun, 17 May 2020 10:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5LmrIZmiQZyJ7CLoCVkmbsukOTFLZwrdqX3s7kCsRxU=; b=RKHj8dgrpMXQhF5CMmNruInoUpdObaGy7lktryJUiXoo4Ahwh0sv7U5ghrFmmwaZYT jtzm1SXt9D4Wn604oIqJtSs/Y6GqCEFk5Iag3rUSQhXSSPqXLG49JiG40/TSoVGsWu+w yeuhx2bSrfPt58vO4KDBDOsV8Em4FwjpkDPxe8OcHBtHa8k8pu2f4v9TJe6DcaZQDypz RsbuKO1L/1l5/YZYXB1+g3mnP02jZqexP+zM9GWqoTL3kvXc5aKG3vGdIlMigcQfApqC JZbHbGN+DIrPpz2akw0Q/4PvQZTDRNKTpMtHwFAe9oHfEfk6DT/dkPaJwy31V7JeJZkC ueIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5LmrIZmiQZyJ7CLoCVkmbsukOTFLZwrdqX3s7kCsRxU=; b=mpiDT2Xdl8JCpINkpUTXniNKZQguTAGHGulNf0msFGs2fhcbmKWuI7dXQpzcWhCZL3 iEtO+sDoCmHtjjsMa3Acu/FDg+oTpXnpqF1f+vWZQEv8sWhOsWzQ3dJYQ22GsyOIg6SW NGLlRMcXhk+wqpS39+9dodJcgcTiMgzcBfP+C30ySKK7w1VYitgyXJhx6AtLFhwUaZGv 4H+yy11jVBqwj/TdHJ7VhhcDBeSyAMhX9pAaGZhUpR/yRWUWrrVoshfuivyCmuzhfkyG AqloVOvk5gRase7tMNuqmu0waYPw/o7UwU7hZM3oroJ0FsIcrmjNkhow9nQpN9OeLou3 WKmQ== X-Gm-Message-State: AOAM532mJI+fmuOpGL/nL8uina/Mj/brJTSIiwRN+Ztn0z2f8ApAxg0b nKGfIRmXHLMVeDXbkqcTs/rZLvKs X-Google-Smtp-Source: ABdhPJzGrpfZ9lg1YejuATRhIkHSj10p8uQHVetGjS5VTJMdc9E/ViYdSdmMIFqDcKpTByBd/6oS5Q== X-Received: by 2002:a7b:c21a:: with SMTP id x26mr14722739wmi.82.1589735865917; Sun, 17 May 2020 10:17:45 -0700 (PDT) Received: from localhost.localdomain (se167-1-82-242-148-1.fbx.proxad.net. [82.242.148.1]) by smtp.gmail.com with ESMTPSA id v126sm13305048wma.9.2020.05.17.10.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 10:17:45 -0700 (PDT) From: Vincent Legoll Date: Sun, 17 May 2020 19:17:02 +0200 Message-Id: <20200517171725.732-5-vincent.legoll@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200517171725.732-1-vincent.legoll@gmail.com> References: <20200517171725.732-1-vincent.legoll@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=RKHj8dgr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: RC03Yu81PFSb * .gitignore: Add /etc/runit/run. * etc/guix-install.sh (chk_init_sys): Add case to detect runit. (sys_enable_guix_daemon): Add case to setup guix-daemon within runit. * etc/runit/run.in: New file. * nix/local.mk (etc/runit/run): Add target to generate etc/runit/run from etc/runit/run.in. (nodist_runitservice_DATA): New variable... (CLEANFILES): ... add it here. (runitservicedir): New variable. (EXTRA_DIST): Add etc/runit/run.in. --- .gitignore | 1 + etc/guix-install.sh | 11 +++++++++++ etc/runit/run.in | 15 +++++++++++++++ nix/local.mk | 14 ++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 etc/runit/run.in diff --git a/.gitignore b/.gitignore index fd2cf56098..89a2c89e1e 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ /etc/guix-publish.conf /etc/guix-publish.service /etc/init.d/guix-daemon +/etc/runit/run /guix-daemon /guix/config.scm /libformat.a diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 7b9a729570..6eff82c444 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -152,6 +152,10 @@ chk_init_sys() _msg "${INF}init system is: sysv-init" INIT_SYS="sysv-init" return 0 + elif [[ -d /etc/sv ]]; then + _msg "${INF}init system is: runit" + INIT_SYS="runit" + return 0 else INIT_SYS="NA" _err "${ERR}Init system could not be detected." @@ -364,6 +368,13 @@ sys_enable_guix_daemon() systemctl enable guix-daemon; } && _msg "${PAS}enabled Guix daemon via systemd" ;; + runit) + { cp -r "${ROOT_HOME}/.config/guix/current/lib/runit/guix-daemon" \ + /etc/sv; + chmod 755 /etc/sv/guix-daemon/run; + ln -s /etc/sv/guix-daemon /etc/runit/runsvdir/default/; } && + _msg "${PAS}enabled Guix daemon via runit" + ;; sysv-init) { mkdir -p /etc/init.d; cp "${ROOT_HOME}/.config/guix/current/etc/init.d/guix-daemon" \ diff --git a/etc/runit/run.in b/etc/runit/run.in new file mode 100644 index 0000000000..e57ef597bc --- /dev/null +++ b/etc/runit/run.in @@ -0,0 +1,15 @@ +#!/bin/sh + +# This is a "run script" for the runit init system to launch +# 'guix-daemon'. Drop it in /etc/sv/guix-daemon and add a symlink to +# it like the following to have 'guix-daemon' automatically started. +# ln -s /etc/sv/guix-daemon /etc/runit/runsvdir/default/ + +GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale +LC_ALL=en_US.utf8 + +export GUIX_LOCPATH LC_ALL + +exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ + --build-users-group=guixbuild + diff --git a/nix/local.mk b/nix/local.mk index 412d89ba3d..582ff16168 100644 --- a/nix/local.mk +++ b/nix/local.mk @@ -1,6 +1,7 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès # Copyright © 2016 Mathieu Lirzin +# Copyright © 2020 Vincent Legoll # # This file is part of GNU Guix. # @@ -175,6 +176,17 @@ etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \ "$<" > "$@.tmp"; \ mv "$@.tmp" "$@" +# The service run script for runit. +runitservicedir = $(libdir)/runit/guix-daemon +nodist_runitservice_DATA = etc/runit/run + +etc/runit/run: etc/runit/run.in \ + $(top_builddir)/config.status + $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ + $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ + "$<" > "$@.tmp"; \ + mv "$@.tmp" "$@" + # The '.conf' jobs for Upstart. upstartjobdir = $(libdir)/upstart/system nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf @@ -189,6 +201,7 @@ etc/guix-%.conf: etc/guix-%.conf.in \ CLEANFILES += \ $(nodist_systemdservice_DATA) \ $(nodist_upstartjob_DATA) \ + $(nodist_runitservice_DATA) \ $(nodist_sysvinitservice_DATA) EXTRA_DIST += \ @@ -198,6 +211,7 @@ EXTRA_DIST += \ etc/guix-daemon.conf.in \ etc/guix-publish.service.in \ etc/guix-publish.conf.in \ + etc/runit/run.in \ etc/init.d/guix-daemon.in if CAN_RUN_TESTS -- 2.26.2