From patchwork Mon Apr 13 16:07:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Legoll X-Patchwork-Id: 21222 X-Patchwork-Delegate: mail@cbaines.net Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F325F27BBE4; Mon, 13 Apr 2020 17:09:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 4138B27BBE1 for ; Mon, 13 Apr 2020 17:09:15 +0100 (BST) Received: from localhost ([::1]:46092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jO1e6-00054k-O3 for patchwork@mira.cbaines.net; Mon, 13 Apr 2020 12:09:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59164) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jO1e0-00051d-5U for guix-patches@gnu.org; Mon, 13 Apr 2020 12:09:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jO1dw-0005OD-KA for guix-patches@gnu.org; Mon, 13 Apr 2020 12:09:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49025) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jO1dw-0005Nj-7V for guix-patches@gnu.org; Mon, 13 Apr 2020 12:09:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jO1dw-0006xB-16 for guix-patches@gnu.org; Mon, 13 Apr 2020 12:09:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40601] [PATCH 5/5] 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: Mon, 13 Apr 2020 16:09:03 +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.158679409326649 (code B ref 40601); Mon, 13 Apr 2020 16:09:03 +0000 Received: (at 40601) by debbugs.gnu.org; 13 Apr 2020 16:08:13 +0000 Received: from localhost ([127.0.0.1]:60568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jO1d2-0006vc-4s for submit@debbugs.gnu.org; Mon, 13 Apr 2020 12:08:13 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:41939) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jO1cv-0006uA-WD for 40601@debbugs.gnu.org; Mon, 13 Apr 2020 12:08:04 -0400 Received: by mail-wr1-f41.google.com with SMTP id h9so10692205wrc.8 for <40601@debbugs.gnu.org>; Mon, 13 Apr 2020 09:08:01 -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=d7XlIXph/dC3p0sp+I8C/nuk/eRXd6pCqWVW4IA61to=; b=TLcgwE4T3Unju7lw1EuNb35smtcCapQA/KC3BZf1NZJUBAzjG5wlEdrvqdkPNXd18G 4YMbFUqwr0ggEDkoT0uVW6QE7b6qbejS5ogONmja0y+OaRu5Iy8VUjZnMRzCRRFapnFv fOpRp/vK7BPWKiqJVClFkvNrllX68Bnn+DPEluYC/plPjeJspaq2QmISu5RJhJJDYmFG 5fhWH6yidi2yvGysyAvbTH3PVmLMhoTleUxC3kD7xnKUsK8grimiKHP+PUgJiuNIi9Sh YyEjOOtoRtW6Np/VKJ1vgFU6W/okUFCVcfFxaLsDFbpgkcWwptCApDirNzCusoIf2F2H MQfQ== 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=d7XlIXph/dC3p0sp+I8C/nuk/eRXd6pCqWVW4IA61to=; b=A1uN7VNuILIC/OHZbM3TDVWxIW+BR2vUZkpvzw0ishyziHNOGpm2LYkNJLHBINCHes ZnwG4qia3W7tT1S22lw4FnT/UPdV4ZW6jIqsXVx4imXMxBS9XUZoKfz0TOag/GTH0vm5 fC4NViRV1wBFqe/eCoojvzDcPhZrPhpeBcAB4KoEI0BHTWIustS8IZ++WKAA774OPQoc 7VTB6jtcm75TCX6Xu8WZFavlQojcPW7CrHDCcCVjko65hvvGtHAPw1nr+PFTpjqxlJ03 JsT2RLaO/X0YAnY8oWvVltIOgjuypDnqk6aKm3rn+lvVXCObEI6sAnJKA9U/40fxjtwE LV9g== X-Gm-Message-State: AGi0PuZzykoIKqssWSf6w/iSHM3qAikY0Mcf6D3N3M6tP8OC8qgGSAbj 9PTuyv5iEsf/DNNe9tZgiWFw4mEl X-Google-Smtp-Source: APiQypJbUoz3JH0g6htS6vOQdQbDSb+/pF48Dfx7Fx3aZ9T4Nrj727JzWH22+su7hVU+qHUQUKWBbw== X-Received: by 2002:a5d:6310:: with SMTP id i16mr6506935wru.177.1586794076101; Mon, 13 Apr 2020 09:07:56 -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 g74sm15248774wme.44.2020.04.13.09.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 09:07:55 -0700 (PDT) From: Vincent Legoll Date: Mon, 13 Apr 2020 18:07:40 +0200 Message-Id: <20200413160740.19584-5-vincent.legoll@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200413160740.19584-1-vincent.legoll@gmail.com> References: <20200413160740.19584-1-vincent.legoll@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * .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 | 13 +++++++++++++ 4 files changed, 40 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 0d15a05cb4..06590ee97f 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..877ddcc281 100644 --- a/nix/local.mk +++ b/nix/local.mk @@ -175,6 +175,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 +200,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 +210,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