From patchwork Mon Oct 21 08:16:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 32284 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 8FAB527BBEA; Mon, 21 Oct 2024 09:18:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 44F7E27BBE2 for ; Mon, 21 Oct 2024 09:18:10 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2nbk-0008Uk-9y; Mon, 21 Oct 2024 04:17:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2nbe-0008Sr-JU for guix-patches@gnu.org; Mon, 21 Oct 2024 04:17:39 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2nbe-0003Ts-4O for guix-patches@gnu.org; Mon, 21 Oct 2024 04:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=2h3AZ2GYfpsfmFYkj1YKl19ZlMJil0xENzRQ2EUkp2I=; b=ZtAKIVzRPQffi67V0rMT4t4aKpDm7LX8gt/+vwKmG57wg5Ry7gNHVSedWbXRaZNJ57fAZXCjgp6HJy1xabG827ye2HOiSqglIYSgU9Gup+p0MoN8YPbVd93v/Yw0KsKYaLLMePVxITGewgr93SF4dEcsapEU82lAv5idR9d/9td3MpXpW96CKF+SL1b1bR0ar0XmYbZK2TNyJCexrgR3oSawKHUhuwIEn6lBYbaAd9WLq+fGW0SROzuhzRGr4+iyCkentmrVyPtjDIMouEmnpYzpcb6Br2ow4dK90fPIOuGw6JT29/gvovCNkDP/RdiXJZ5pcuascP+vU6vj6k7hlQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2nc4-0003fU-7z for guix-patches@gnu.org; Mon, 21 Oct 2024 04:18:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73927] [PATCH 03/16] hurd-boot: Support system init: Create essential device nodes. Resent-From: Janneke Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 21 Oct 2024 08:18:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73927 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73927@debbugs.gnu.org Received: via spool by 73927-submit@debbugs.gnu.org id=B73927.172949868114055 (code B ref 73927); Mon, 21 Oct 2024 08:18:04 +0000 Received: (at 73927) by debbugs.gnu.org; 21 Oct 2024 08:18:01 +0000 Received: from localhost ([127.0.0.1]:49994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2nc1-0003eW-8O for submit@debbugs.gnu.org; Mon, 21 Oct 2024 04:18:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2nbu-0003dL-Ly for 73927@debbugs.gnu.org; Mon, 21 Oct 2024 04:17:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2nbO-0003RN-Vo; Mon, 21 Oct 2024 04:17:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=2h3AZ2GYfpsfmFYkj1YKl19ZlMJil0xENzRQ2EUkp2I=; b=RH1WAS2UEP7qMDbslix/ BnZ1nitDFyxwVrwLuZjWspPOfmUSxjxZpw87WlRtlD34cEE0ZiZA0fi1BRccMueSjNQCw7yRW6jEG dEVL8t+MCOTgSfaSgOksx8LKHe5kux7Eo/gYFnUO3q3ToSwmkohumc+xhwYcAB/LEelpCPZaZdDiq KYBGmZBBjTKZviBAhf7nTg9ljB4nr+5zeTVrW7H+bm1N+1qt7vNDohCRubk7t6x2iTcepOFtAwm79 4LdEkCiiDCRFEF+/uOpGTzaZ8b71cMFgWcJS7zXWtvxmJSJ6c7j0512jTnZRFR6Tt5wEx8n+pYhbD 34KCFZaxb4pO0Q==; From: Janneke Nieuwenhuizen Date: Mon, 21 Oct 2024 10:16:59 +0200 Message-ID: <2cebd1cf836781f4330a223a890f6d1d60879913.1729494414.git.janneke@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/build/hurd-boot.scm (make-hurd-device-nodes): Cater for existing directories (dev, servers). (set-hurd-device-translators): Remove /servers/socket/1, that is created by libexec/console-run. Cater for nonexistent /dev/console. (boot-hurd-system): Call make-hurd-device-nodes on initial run. --- gnu/build/hurd-boot.scm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm index 4407284acb..daf4fb41ab 100644 --- a/gnu/build/hurd-boot.scm +++ b/gnu/build/hurd-boot.scm @@ -79,13 +79,13 @@ (define* (make-hurd-device-nodes #:optional (root "/")) (define (scope dir) (string-append root (if (string-suffix? "/" root) "" "/") dir)) - (mkdir (scope "dev")) + (mkdir-p (scope "dev")) ;; Don't create /dev/null etc just yet; the store ;; messes-up the permission bits. ;; Don't create /dev/console, /dev/vcs, etc.: they are created by ;; console-run on first boot. - (mkdir (scope "servers")) + (mkdir-p (scope "servers")) (for-each (lambda (file) (call-with-output-file (scope (string-append "servers/" file)) (lambda (port) @@ -100,7 +100,8 @@ (define* (make-hurd-device-nodes #:optional (root "/")) "kill" "suspend")) - (mkdir (scope "servers/socket")) + (mkdir-p (scope "servers/socket")) + ;; Don't create /servers/socket/1 & co: runsystem does that on first boot. ;; TODO: Set the 'gnu.translator' extended attribute for passive translator @@ -279,7 +280,8 @@ (define* (set-hurd-device-translators #:optional (root "/")) (for-each scope-set-translator servers) (mkdir* "dev/vcs/1") (mkdir* "dev/vcs/2") - (rename-file (scope "dev/console") (scope "dev/console-")) + (when (file-exists? (scope "dev/console")) + (rename-file (scope "dev/console") (scope "dev/console-"))) (for-each scope-set-translator devices) (false-if-EEXIST (symlink "/dev/random" (scope "dev/urandom"))) @@ -326,6 +328,10 @@ (define* (boot-hurd-system #:key (on-error 'debug)) (let ((hurd/hurd (readlink* (string-append system "/profile/hurd")))) (symlink hurd/hurd "/hurd")) + (unless (file-exists? "/servers/startup") + (format #t "Creating essential device nodes...\n") + (make-hurd-device-nodes)) + (format #t "Setting-up essential translators...\n") (setenv "PATH" (string-append system "/profile/bin")) (set-hurd-device-translators)