GNU bug report logs - #60068
[PATCH 1/2] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment variable.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; merged with #60069; dated Wed, 14 Dec 2022 15:57:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Forcibly Merged 60068 60069. Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60068 <at> debbugs.gnu.org:


Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 20:47:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 15:47:05 2022
Received: from localhost ([127.0.0.1]:41792 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5Yef-0004Di-HT
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 15:47:05 -0500
Received: from mail-vk1-f175.google.com ([209.85.221.175]:43844)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1p5Yec-0004Co-0I
 for 60068 <at> debbugs.gnu.org; Wed, 14 Dec 2022 15:47:02 -0500
Received: by mail-vk1-f175.google.com with SMTP id g137so3743227vke.10
 for <60068 <at> debbugs.gnu.org>; Wed, 14 Dec 2022 12:47:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=45V4zygLPUbUUHmAG3m2+7+BRyv6ncJsMrXYIl7BXM4=;
 b=PZs+djoCMCmLZZb3IUHAwrIOdXIJ90y+uAWFfuuALzg3u6cwMORIY+pZIljB+Sid1q
 X9iN50cFHM6uWr84xtAOvGoQ8yynfGAIMHwvVDqNCC7Xwnu2ntgd+MAqJCPVMdrZ4dHR
 rMI3IJJHSEJbIYrb3V9IDdFTcV7rvcWNV/OhVFeyp/+nhWte1Q37jNz0L93QylxuFiIo
 IENN457vX3ppzv7aXTnc1AXpnlTnvC9pVFg+Lpzj5naH7JIQxcEPBbVv/M1KW2v1P5d3
 RuhKy+SVmtDhFoDuKm+hs8Vw5H1ekz2lqgr7HWfqD7XpRoWXMMmIMp2CSjXZbFmRFJOy
 XcJw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=45V4zygLPUbUUHmAG3m2+7+BRyv6ncJsMrXYIl7BXM4=;
 b=SGGRiTIUfhv2dNkaoGKG98EN63MfvCDlGwJJKdUPu4OnY/rX0q6nMEaRfcQfDAJOSJ
 EWe0WfS6kpyV5ugKoTv41vni/Sxr8c4opmMrtxj7hpENpVEJe+w1Ze62jWgMFZsMy6Wt
 9fDWjDjav9fbRGXcJno6n2awZbUL6VQmdE1QhBWhvUhMwyORN1xXa2lWzlOZG1wGXGcZ
 jVNI/Qo0K1/SaS3rPCua3q6NKDgMWDx0uPOArAjMXog+InCnxbtARHMOFSSF+mMSESRw
 /vpchpo3sdxbmry35T9BiV2YMD4vKb2kg3ysy/3JuK7jYfhLfb6s9cJjrTk4j3ytTgn2
 XkWA==
X-Gm-Message-State: ANoB5pkO9zJgb3pp6EAEhMr0hR5OV1/l77futnIGBRxsNHY9QDDUlaYe
 OosSL8g8hxbX83azM6BtRFdCLBRsK+33XQ==
X-Google-Smtp-Source: AA0mqf5GCbN7rsc4OPyW9+4Pj/cv8X8B8CyDk/CyDy5K2+CP5gQ/D0Q+OdF5+K9/wOgs9V/5qgnXfg==
X-Received: by 2002:a1f:9f42:0:b0:3bc:d00d:82e6 with SMTP id
 i63-20020a1f9f42000000b003bcd00d82e6mr15732643vke.2.1671050816393; 
 Wed, 14 Dec 2022 12:46:56 -0800 (PST)
Received: from localhost.localdomain ([2607:fad8:4:3::1006])
 by smtp.gmail.com with ESMTPSA id
 p13-20020a05620a112d00b006f87d28ea3asm10192676qkk.54.2022.12.14.12.46.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Dec 2022 12:46:56 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60068 <at> debbugs.gnu.org
Subject: [PATCH v2 3/3] guix-install.sh: Directly exit in case of errors in
 chk_require.
Date: Wed, 14 Dec 2022 15:46:40 -0500
Message-Id: <20221214204640.16879-3-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20221214204640.16879-1-maxim.cournoyer@HIDDEN>
References: <20221214204640.16879-1-maxim.cournoyer@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60068
Cc: me@HIDDEN, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* etc/guix-install.sh (chk_require): Directly exit in case of errors in
chk_require, instead of relying on 'set -e'.
---
 etc/guix-install.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 62d85e765a..ea10f35250 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -137,10 +137,8 @@ chk_require()
         command -v "$c" &>/dev/null || warn+=("$c")
     done
 
-    [ "${#warn}" -ne 0 ] &&
-        { _err "${ERR}Missing commands: ${warn[*]}.";
-          return 1; }
-    
+    [ "${#warn}" -ne 0 ] && die "Missing commands: ${warn[*]}."
+
     _msg "${PAS}verification of required commands completed"
 }
 
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at 60068 <at> debbugs.gnu.org:


Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 20:47:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 15:47:01 2022
Received: from localhost ([127.0.0.1]:41787 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5Yeb-0004D0-0m
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 15:47:01 -0500
Received: from mail-vk1-f176.google.com ([209.85.221.176]:36773)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1p5YeZ-0004Ch-3b
 for 60068 <at> debbugs.gnu.org; Wed, 14 Dec 2022 15:46:59 -0500
Received: by mail-vk1-f176.google.com with SMTP id l17so3761570vkk.3
 for <60068 <at> debbugs.gnu.org>; Wed, 14 Dec 2022 12:46:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Un0fZJVaLUxbKw8DTSotXo0HP/nDyh/LNRYFXBJIEhQ=;
 b=nJdd2Va10Aqw8PFd4EDn+eRpXEogj3qc7PtRYVR/WW8EkOd4qxex3yv9uORuMCKOnm
 pJ9o9LKx/bIkh40JnDp2kj+Kp0Qe+BJRDmOqtG/eXb7xxn4Bu5pf0QxjzcpcJ8lulOpD
 znDH2ytGXlyuIACV6yDAFW/4gqjQR7nDvR0Po5qnXHPLjxZAG6DOLlTi7RhLQS5P7jMl
 Dly82des+YGIbreRqKt3pkTT5ByF4u3vW1qjQ3qrk/GZ6+K+qlQjf0rfCXjo/YJy3Z6k
 eajfddUTTnZeNpFxnN/4zmx8S9jHLbN1Md5qJ7wT0+D+TRn7asnnfIl3H7bdkBEk0buQ
 R36w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Un0fZJVaLUxbKw8DTSotXo0HP/nDyh/LNRYFXBJIEhQ=;
 b=r+tJFgu9xzwVWRdnjYJP6JEDpQnl/odkHs+mf4rXWsp4LDO63GSbA4qCiIj5cS+MzJ
 d7JHpVkLSFHt847KTbfbkhaRFNioslFsANRht99Dmo0l0uCuv+PKzOnvADvZ2pD1sYNS
 72YuiyumXwQ6Wr0AZLQ8Wc+mJci1nsGcxRQLpbCHzPn+f0EYCaek3jBTI1O2D/PR8IEJ
 h0yBB4PGzlczsl4SXiauuMj7xklw3mgloUPZl7/p3e5kjVd5K07oPIkKQ01cfTdFvkrn
 joZPZtRU6W1jTxc3k1PXepn0+RsEc7l4ipid3r5/55/RuAQjEwan1VHhILoiT7yWL7Sl
 ibiw==
X-Gm-Message-State: ANoB5pn2qWIauvuAP6P7zb6V5At+eByVSSnX/qZbkwEKjM79ZttpCosA
 9BnmsLP39dBr79ymFZ9m6QwTVR/fud60RQ==
X-Google-Smtp-Source: AA0mqf51yW3eD6cDdoCOl1Nxef/3Y2DkEoLy7sKOAWtlJ8zH8oTMKBi+S86IRDFloZBDC+4ZaXHRiw==
X-Received: by 2002:a1f:ea42:0:b0:3bd:fb7f:e385 with SMTP id
 i63-20020a1fea42000000b003bdfb7fe385mr13349086vkh.8.1671050813270; 
 Wed, 14 Dec 2022 12:46:53 -0800 (PST)
Received: from localhost.localdomain ([2607:fad8:4:3::1006])
 by smtp.gmail.com with ESMTPSA id
 p13-20020a05620a112d00b006f87d28ea3asm10192676qkk.54.2022.12.14.12.46.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Dec 2022 12:46:52 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60068 <at> debbugs.gnu.org
Subject: [PATCH v2 2/3] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment
 variable.
Date: Wed, 14 Dec 2022 15:46:39 -0500
Message-Id: <20221214204640.16879-2-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20221214204640.16879-1-maxim.cournoyer@HIDDEN>
References: <20221214204640.16879-1-maxim.cournoyer@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60068
Cc: me@HIDDEN, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

The need for this use case appeared when attempting to install Guix on a truly
minimal image made with Buildroot, which lacked enough GNU components that I
had to extract a guix pack to /gnu before attempting installation, which would
then refuse to proceed because of the existing /gnu.

* etc/guix-install.sh: Document environment variables.
(sys_create_store) [GUIX_ALLOW_OVERWRITE]: Skip pre-existing installation
checks and output a warning.  Extract the tarball directly to /.
---
 etc/guix-install.sh | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index b8ea9e54c3..62d85e765a 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -29,6 +29,22 @@
 
 # We require Bash but for portability we'd rather not use /bin/bash or
 # /usr/bin/env in the shebang, hence this hack.
+
+# Environment variables
+#
+# GUIX_BINARY_FILE_NAME
+#
+# Can be used to override the automatic download mechanism and point
+# to a local Guix binary archive filename like
+# "/tmp/guix-binary-1.4.0rc2.armhf-linux.tar.xz"
+#
+# GUIX_ALLOW_OVERWRITE
+#
+# Instead of aborting to avoid overwriting a previous installations,
+# allow copying over /var/guix or /gnu.  This can be useful when the
+# installation required the user to extract Guix packs under /gnu to
+# satisfy its dependencies.
+
 if [ "x$BASH_VERSION" = "x" ]
 then
     exec bash "$0" "$@"
@@ -338,16 +354,15 @@ sys_create_store()
 
     _debug "--- [ ${FUNCNAME[0]} ] ---"
 
-    if [[ -e "/var/guix" || -e "/gnu" ]]; then
+    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu) ]]; then
         die "A previous Guix installation was found.  Refusing to overwrite."
+    else
+        _msg "${WAR}Overwriting existing installation!"
     fi
 
     cd "$tmp_path"
-    tar --extract --file "$pkg" && _msg "${PAS}unpacked archive"
-
     _msg "${INF}Installing /var/guix and /gnu..."
-    mv "${tmp_path}/var/guix" /var/
-    mv "${tmp_path}/gnu" /
+    tar --extract --file "$pkg" -C /
 
     _msg "${INF}Linking the root user's profile"
     mkdir -p ~root/.config/guix
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at 60068 <at> debbugs.gnu.org:


Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 20:46:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 15:46:57 2022
Received: from localhost ([127.0.0.1]:41784 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5YeW-0004Cn-Ph
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 15:46:56 -0500
Received: from mail-qv1-f48.google.com ([209.85.219.48]:35536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1p5YeU-0004Cg-FI
 for 60068 <at> debbugs.gnu.org; Wed, 14 Dec 2022 15:46:54 -0500
Received: by mail-qv1-f48.google.com with SMTP id i12so580233qvs.2
 for <60068 <at> debbugs.gnu.org>; Wed, 14 Dec 2022 12:46:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=s1S5diU0loMggoAHjZl0JwyWRf9X445sUSvA71M+bJE=;
 b=Ktp7ej3EuIc0YEgvKJA3EBwpUsaS/B9swHXFzYIDjiNoYQ3k1tHxMxa9xUX1LARRlL
 mrPe7wOFZ+sq89bukGX36SaqyM7MKNNn7j9iDkISxiCm/W2bihqyzB2o7cNrmJ0DoOnT
 zmKW66Qi/rzs7Ph+wlNBcN07n4e7bkyjoQgZ2pbYICUs6lzlCfmvXHtqLSFDw04vmAd6
 nokyWtB/d9NgQy8y1/8kM2Z5znZm4d40hgJG+q2bA/2DADDiSfyi6iwMp+snJxDP+8g3
 ogsIhXTWxSOLSiaiDLmWDvHjj6pwZkyV9CZnuxk5uaeN0yK0391UzuTAZ0vbXYwWrmvn
 wFBw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=s1S5diU0loMggoAHjZl0JwyWRf9X445sUSvA71M+bJE=;
 b=Gov9wjSPlC64gcWKMK+OfxcCruBcSAHgd7im6e/JBP2com6gT9726U4kZ35Yykx+fy
 IvAoOgC6VuULWnNdJ7N/+KYkrQbi1mCrQp5SWdw9L2AuroiqVi3JPmIqA1k8mMGaboAH
 FBeJ/04WoU+XtjQ9d0HMHkwpNaTIGNDZn47Zv+KHNwckgw6El7lLEhW8Wkb9pvyJLH8K
 LnIqgt3UokekUSFLChdP5Oy79GDtodhdJ6c01kYbF0TfvvXMSjMtzi+gB73jVPL85N1f
 WZRSppHtqtmucp+3+RUNZNI6H/l6vIJVJeyBCHz1WmPasQJFgaTaSKhaFuH2p2G1rpLV
 g+TQ==
X-Gm-Message-State: ANoB5pnOVptg8bR7XXQzfvRnAu13psziZzD3WQNWoHa3qOENg+x3k+39
 1JaY25HddaLK6T3MdW6OXZmYS+r+GA5wyw==
X-Google-Smtp-Source: AA0mqf518wTVFsEkVgQFLv2qprarSxwVXtt+2NNGPeaY0Kw7nokfjB0VKrrp694LgPpuMXUpv/SRIg==
X-Received: by 2002:a05:6214:3607:b0:4c7:6938:329d with SMTP id
 nv7-20020a056214360700b004c76938329dmr38867703qvb.0.1671050808689; 
 Wed, 14 Dec 2022 12:46:48 -0800 (PST)
Received: from localhost.localdomain ([2607:fad8:4:3::1006])
 by smtp.gmail.com with ESMTPSA id
 p13-20020a05620a112d00b006f87d28ea3asm10192676qkk.54.2022.12.14.12.46.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Dec 2022 12:46:48 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60068 <at> debbugs.gnu.org
Subject: [PATCH v2 1/3] guix-install.sh: Add missing "useradd" command.
Date: Wed, 14 Dec 2022 15:46:38 -0500
Message-Id: <20221214204640.16879-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60068
Cc: me@HIDDEN, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* etc/guix-install.sh: (REQUIRE): Add missing "useradd" command.
---
 etc/guix-install.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index f008593d84..b8ea9e54c3 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -53,6 +53,7 @@ REQUIRE=(
     "chmod"
     "uname"
     "groupadd"
+    "useradd"
     "tail"
     "tr"
     "xz"

base-commit: fa23fb86f7741570d194bba1f227016d9aa25881
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at 60068 <at> debbugs.gnu.org:


Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 18:25:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 13:25:17 2022
Received: from localhost ([127.0.0.1]:40832 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5WRR-0006EM-H3
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 13:25:17 -0500
Received: from mail-qt1-f174.google.com ([209.85.160.174]:35799)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1p5WRN-0006Dz-54
 for 60068 <at> debbugs.gnu.org; Wed, 14 Dec 2022 13:25:15 -0500
Received: by mail-qt1-f174.google.com with SMTP id h16so3191985qtu.2
 for <60068 <at> debbugs.gnu.org>; Wed, 14 Dec 2022 10:25:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ovMA1yYudgloTuA9/nVOFX5koLSSm+x//KFueCR8NfA=;
 b=JPx4+mhXO3yhEDPDHYN6j6yJFSyYXWfokc1Dcc2p+HAckI0jdM97zQGpyopcsc5fLv
 B6LjJYYn6KsQa/t3a094b4ELfOeVc4VAkgOWkH7cx3bO9xmAJJU0uzvHyLIbWBNAPdVT
 ZgfyOQ3pFzaVeDGMD/XvAAjtDlseAUGDFP7/+mFCxeoAEQnBopO4LUQrjkLXmYKJcvjd
 biW+eejbpUv0PIRylJib3I2izd5GDH2yIvS6l4a9kwiQFThEY7uCNsfq0znBG9bHy//5
 B486u4wEqg9RoEoCLZawsyuBtvn4KAkURpoR9C7GtLffsBpxIOm/cUI3kGn7XMNCeLgn
 /DhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ovMA1yYudgloTuA9/nVOFX5koLSSm+x//KFueCR8NfA=;
 b=snaG3XRrLw/ooetoTPcGIJGtgwa0F1FY8eclDj+EMiL2DAAGZo+kl/SWONx5G+kddN
 5ExR9A41XeCs93xRnawEcIvCdM8fIeIr9Tv1i7g/RXayWr8gY42D4le1lbYbDr1RZvEQ
 ZJdMO94SpS2JHozmLmlayYHM9XN9nVrZCI6DW/5dIrHa0GGEPoUyVAw6gxJExvjPRoyT
 Sw8dJCfGS/cy0jA11TDYCX++l8RNBdv/i2alajdW3TvAxeiDX4T2osFg5G9jsStTMt+q
 JbThQRRjLp59mmJp+Rwctt+AN5oqDJ55JYPUHn9Ns+MzbnW8RgVv5M1fV8EAzrSok1OI
 SlHw==
X-Gm-Message-State: ANoB5pkCkLx7k4KvCEWq3oth6WFCQlLhgWoCdxXRUogglHBPxVbzvyqf
 RPa/CBYgPSXyhoGjRyV3bkg=
X-Google-Smtp-Source: AA0mqf6UwWje3HNfRkRJzf2OPgdyfwpGZlEb33km+PjFesdmqCnF9XiO8shfN+AB7uP+Pi4499JCuA==
X-Received: by 2002:ac8:6f09:0:b0:3a8:1f82:5b66 with SMTP id
 bs9-20020ac86f09000000b003a81f825b66mr12481585qtb.18.1671042307693; 
 Wed, 14 Dec 2022 10:25:07 -0800 (PST)
Received: from hurd ([2607:fad8:4:3::1006]) by smtp.gmail.com with ESMTPSA id
 u13-20020a05620a430d00b006fbdeecad51sm10525718qko.48.2022.12.14.10.25.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Dec 2022 10:25:07 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: Tobias Geerinckx-Rice <me@HIDDEN>
Subject: Re: [bug#60068] [PATCH 1/2] guix-install.sh: Add
 GUIX_ALLOW_OVERWRITE environment variable.
References: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
 <875yeec57z.fsf@nckx>
Date: Wed, 14 Dec 2022 13:25:06 -0500
In-Reply-To: <875yeec57z.fsf@nckx> (Tobias Geerinckx-Rice's message of "Wed,
 14 Dec 2022 17:16:19 +0100")
Message-ID: <87zgbp3ksd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 60068
Cc: 60068 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Tobias,

Tobias Geerinckx-Rice <me@HIDDEN> writes:

> Hi Maxim,
>
> Nice!  More steps towards world domination.

Eh :-)

> Maxim Cournoyer =E5=86=99=E9=81=93=EF=BC=9A
>> +# Environment variables
>
> These sound like they should be command-line arguments.

I agree, but that'd require a loop, or GNU getopt, and I'm not motivated
enough in the moment to re-design it :-).  When we get there, we could
add an --uninstall option too.

> [=E2=80=A6]
>
> Actually, I'm not totally sold on GUIX_ALLOW_OVERWRITE.  It's not
> solving much a problem.

The problem it solves for me was that I needed to use 'guix pack'd
dependencies such as gpg, glibc for getent, and shadow's
groupadd/useradd, etc. to satisfy the install script dependencies on my
weird target OS (minimal busybox embedded OS); which are needed to be
unpacked under /gnu, thus conflicting with the requirement that /gnu
doesn't exist.

I tried a relocatable pack, but it didn't work, at least for gpg (file
not found error).

> Instead, the error message could be specific about what it considers a
> =E2=80=98previous Guix installation=E2=80=99 =E2=80=94 which would be a g=
ood idea regardless =E2=80=94
> and tell the admin exactly what needs to be removed to continue.
>
>>      "groupadd"
>> +    "useradd"
>
> Good catch, but separate patch.  (=E2=99=AA)

OK!

>> -    if [[ -e "/var/guix" || -e "/gnu" ]]; then
>> +    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu) ]];
>> then
>>          die "A previous Guix installation was found.  Refusing
>> to overwrite."
>> +    else
>> +        _msg "${WAR}Overwriting existing installation!"
>>      fi
>>       cd "$tmp_path"
>> -    tar --extract --file "$pkg" && _msg "${PAS}unpacked archive"
>> -
>>      _msg "${INF}Installing /var/guix and /gnu..."
>> -    mv "${tmp_path}/var/guix" /var/
>> -    mv "${tmp_path}/gnu" /
>> +    tar --extract --file "$pkg" -C /
>
> I'm still in favour of using something like =E2=80=98mktemp -d /gnu.XXXXX=
X=E2=80=99
> here if there's no security flaw I missed.  WDYT?
>
> If the overwrite functionality is kept, we should remove the old
> directories before re-populating them.

Hopefully the reason the above makes more sense is also covered by my
use case explanation above.

Is the use case/change motivation a bit clearer now?

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Dec 2022 18:25:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 13:25:15 2022
Received: from localhost ([127.0.0.1]:40830 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5WRP-0006EA-1V
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 13:25:15 -0500
Received: from lists.gnu.org ([209.51.188.17]:34684)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1p5WRL-0006E2-IU
 for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 13:25:14 -0500
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 <maxim.cournoyer@HIDDEN>)
 id 1p5WRL-0001v7-8p
 for guix-patches@HIDDEN; Wed, 14 Dec 2022 13:25:11 -0500
Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1p5WRI-0004VF-UJ
 for guix-patches@HIDDEN; Wed, 14 Dec 2022 13:25:10 -0500
Received: by mail-qt1-x833.google.com with SMTP id z12so3174631qtv.5
 for <guix-patches@HIDDEN>; Wed, 14 Dec 2022 10:25:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ovMA1yYudgloTuA9/nVOFX5koLSSm+x//KFueCR8NfA=;
 b=JPx4+mhXO3yhEDPDHYN6j6yJFSyYXWfokc1Dcc2p+HAckI0jdM97zQGpyopcsc5fLv
 B6LjJYYn6KsQa/t3a094b4ELfOeVc4VAkgOWkH7cx3bO9xmAJJU0uzvHyLIbWBNAPdVT
 ZgfyOQ3pFzaVeDGMD/XvAAjtDlseAUGDFP7/+mFCxeoAEQnBopO4LUQrjkLXmYKJcvjd
 biW+eejbpUv0PIRylJib3I2izd5GDH2yIvS6l4a9kwiQFThEY7uCNsfq0znBG9bHy//5
 B486u4wEqg9RoEoCLZawsyuBtvn4KAkURpoR9C7GtLffsBpxIOm/cUI3kGn7XMNCeLgn
 /DhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ovMA1yYudgloTuA9/nVOFX5koLSSm+x//KFueCR8NfA=;
 b=CpIFHM+n/p0dFTleUNqYTxo3OGUMmQ5LAKvRpkQB8i7GHzdK8ZV1gCV2nMLqTg3q2f
 izYY97gZGs5fEBmeBITtarW0tCfTt1K1Ms9+Wx5Cwk77wsK9LqJk/vZy7C9GsyLRQKAq
 MZeVG+hIfUrQsWlqpBzAnJ1YCzZZN/SmnaZFm0qG0Mof+YngJjx8yUM1EVAsXQsx/bRY
 pYcEg4KNZOCw3ddkFH7va+pRkZMB6EPcW3KvB7B3W5MRQZBS2k2FQ/ym/nabma97cDaS
 3Wq+EK0gY9eZ1l1SyVec1FiV+93cnM0WLBE9dh/pievgzqDKowxok45zjwxoW1spsP1T
 nFlA==
X-Gm-Message-State: ANoB5pnkZLL+/NXIsCZt18qAxi3lQ1A7N92RU5ADLGYN0EjD2ZkHPS6+
 7tm26dsQk1nPWFpPY0zrk/ljqgT3qnzzLA==
X-Google-Smtp-Source: AA0mqf6UwWje3HNfRkRJzf2OPgdyfwpGZlEb33km+PjFesdmqCnF9XiO8shfN+AB7uP+Pi4499JCuA==
X-Received: by 2002:ac8:6f09:0:b0:3a8:1f82:5b66 with SMTP id
 bs9-20020ac86f09000000b003a81f825b66mr12481585qtb.18.1671042307693; 
 Wed, 14 Dec 2022 10:25:07 -0800 (PST)
Received: from hurd ([2607:fad8:4:3::1006]) by smtp.gmail.com with ESMTPSA id
 u13-20020a05620a430d00b006fbdeecad51sm10525718qko.48.2022.12.14.10.25.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Dec 2022 10:25:07 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: Tobias Geerinckx-Rice <me@HIDDEN>
Subject: Re: [bug#60068] [PATCH 1/2] guix-install.sh: Add
 GUIX_ALLOW_OVERWRITE environment variable.
References: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
 <875yeec57z.fsf@nckx>
Date: Wed, 14 Dec 2022 13:25:06 -0500
In-Reply-To: <875yeec57z.fsf@nckx> (Tobias Geerinckx-Rice's message of "Wed,
 14 Dec 2022 17:16:19 +0100")
Message-ID: <87zgbp3ksd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2607:f8b0:4864:20::833;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qt1-x833.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: 60068 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi Tobias,

Tobias Geerinckx-Rice <me@HIDDEN> writes:

> Hi Maxim,
>
> Nice!  More steps towards world domination.

Eh :-)

> Maxim Cournoyer =E5=86=99=E9=81=93=EF=BC=9A
>> +# Environment variables
>
> These sound like they should be command-line arguments.

I agree, but that'd require a loop, or GNU getopt, and I'm not motivated
enough in the moment to re-design it :-).  When we get there, we could
add an --uninstall option too.

> [=E2=80=A6]
>
> Actually, I'm not totally sold on GUIX_ALLOW_OVERWRITE.  It's not
> solving much a problem.

The problem it solves for me was that I needed to use 'guix pack'd
dependencies such as gpg, glibc for getent, and shadow's
groupadd/useradd, etc. to satisfy the install script dependencies on my
weird target OS (minimal busybox embedded OS); which are needed to be
unpacked under /gnu, thus conflicting with the requirement that /gnu
doesn't exist.

I tried a relocatable pack, but it didn't work, at least for gpg (file
not found error).

> Instead, the error message could be specific about what it considers a
> =E2=80=98previous Guix installation=E2=80=99 =E2=80=94 which would be a g=
ood idea regardless =E2=80=94
> and tell the admin exactly what needs to be removed to continue.
>
>>      "groupadd"
>> +    "useradd"
>
> Good catch, but separate patch.  (=E2=99=AA)

OK!

>> -    if [[ -e "/var/guix" || -e "/gnu" ]]; then
>> +    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu) ]];
>> then
>>          die "A previous Guix installation was found.  Refusing
>> to overwrite."
>> +    else
>> +        _msg "${WAR}Overwriting existing installation!"
>>      fi
>>       cd "$tmp_path"
>> -    tar --extract --file "$pkg" && _msg "${PAS}unpacked archive"
>> -
>>      _msg "${INF}Installing /var/guix and /gnu..."
>> -    mv "${tmp_path}/var/guix" /var/
>> -    mv "${tmp_path}/gnu" /
>> +    tar --extract --file "$pkg" -C /
>
> I'm still in favour of using something like =E2=80=98mktemp -d /gnu.XXXXX=
X=E2=80=99
> here if there's no security flaw I missed.  WDYT?
>
> If the overwrite functionality is kept, we should remove the old
> directories before re-populating them.

Hopefully the reason the above makes more sense is also covered by my
use case explanation above.

Is the use case/change motivation a bit clearer now?

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Dec 2022 16:35:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 11:35:03 2022
Received: from localhost ([127.0.0.1]:40242 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5Uil-0004zJ-7M
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 11:35:03 -0500
Received: from lists.gnu.org ([209.51.188.17]:43918)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1p5Uih-0004yk-Lp
 for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 11:34:59 -0500
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 <me@HIDDEN>) id 1p5Uih-0000UU-Db
 for guix-patches@HIDDEN; Wed, 14 Dec 2022 11:34:59 -0500
Received: from tobias.gr ([80.241.217.52])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1p5Uif-0005ZS-Hm
 for guix-patches@HIDDEN; Wed, 14 Dec 2022 11:34:59 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=aUn/po7Ll9Pe9
 CYGKOK7D4ZgNZjc9oqcBJETlzXaLFU=;
 h=in-reply-to:date:subject:cc:to:
 from:references; d=tobias.gr; b=ap8aGhr9j+KqO0xdPQNLulZ0FSuUHUUq9Vp3Do
 RB0I6t7L6UYziIHqgeIowJa7u2j07qPmT8Eg7gVFQnni0kccDfEiLBW504y+uW9+o+Ia0s
 9oDD9T6jtP4b0VCJz6V8vwxIz30UBBE8PO5cHzWEqPJ8eBwfSFEl7A2QWaUQ4ngqpfQFn7
 NcmFdu+IG66l5ybPh0tpdyytnzJ3czOk5Jw08vg6XrqGBIEe+bw6cOImLFLDmM8vaSgtJG
 ecMWp3nNse7n+91DR1MJPi9OmlDcoRfX+eELLyGocghdEcb9aZNv4hQDkff8LgoSpr/dJ4
 WSzvR/Lokl/zr4oyLTGyr0TA==
Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id a8987525
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Wed, 14 Dec 2022 16:34:50 +0000 (UTC)
References: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
From: Tobias Geerinckx-Rice <me@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#60068] [PATCH 1/2] guix-install.sh: Add
 GUIX_ALLOW_OVERWRITE environment variable.
Date: Wed, 14 Dec 2022 17:16:19 +0100
In-reply-to: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
BIMI-Selector: v=BIMI1; s=default;
Message-ID: <875yeec57z.fsf@nckx>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
Received-SPF: pass client-ip=80.241.217.52; envelope-from=me@HIDDEN;
 helo=tobias.gr
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
Cc: 60068 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi Maxim,

Nice!  More steps towards world domination.

Maxim Cournoyer =E5=86=99=E9=81=93=EF=BC=9A
> +# Environment variables

These sound like they should be command-line arguments.

[=E2=80=A6]

Actually, I'm not totally sold on GUIX_ALLOW_OVERWRITE.  It's not=20
solving much a problem.

Instead, the error message could be specific about what it=20
considers a =E2=80=98previous Guix installation=E2=80=99 =E2=80=94 which wo=
uld be a good=20
idea regardless =E2=80=94 and tell the admin exactly what needs to be=20
removed to continue.

>      "groupadd"
> +    "useradd"

Good catch, but separate patch.  (=E2=99=AA)

> -    if [[ -e "/var/guix" || -e "/gnu" ]]; then
> +    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu)=20
> ]]; then
>          die "A previous Guix installation was found.  Refusing=20
>          to overwrite."
> +    else
> +        _msg "${WAR}Overwriting existing installation!"
>      fi
>=20=20
>      cd "$tmp_path"
> -    tar --extract --file "$pkg" && _msg "${PAS}unpacked=20
> archive"
> -
>      _msg "${INF}Installing /var/guix and /gnu..."
> -    mv "${tmp_path}/var/guix" /var/
> -    mv "${tmp_path}/gnu" /
> +    tar --extract --file "$pkg" -C /

I'm still in favour of using something like =E2=80=98mktemp -d=20
/gnu.XXXXXX=E2=80=99 here if there's no security flaw I missed.  WDYT?

If the overwrite functionality is kept, we should remove the old=20
directories before re-populating them.

Kind regards,

T G-R

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCY5n7kA0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15JYQA/0MC+9Nq+MATmo1+I6w6hw1wcCsFaUR5bzjr3DyO
vmKWAP9ZPyqhLEYgIENx0DPBEz0p8zLD2G/yx5gCCHWgFyEmAA==
=++lV
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at 60068 <at> debbugs.gnu.org:


Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 16:34:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 11:34:59 2022
Received: from localhost ([127.0.0.1]:40238 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5Uig-0004yd-TL
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 11:34:59 -0500
Received: from tobias.gr ([80.241.217.52]:55566)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1p5Uid-0004yX-3b
 for 60068 <at> debbugs.gnu.org; Wed, 14 Dec 2022 11:34:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=aUn/po7Ll9Pe9
 CYGKOK7D4ZgNZjc9oqcBJETlzXaLFU=;
 h=in-reply-to:date:subject:cc:to:
 from:references; d=tobias.gr; b=ap8aGhr9j+KqO0xdPQNLulZ0FSuUHUUq9Vp3Do
 RB0I6t7L6UYziIHqgeIowJa7u2j07qPmT8Eg7gVFQnni0kccDfEiLBW504y+uW9+o+Ia0s
 9oDD9T6jtP4b0VCJz6V8vwxIz30UBBE8PO5cHzWEqPJ8eBwfSFEl7A2QWaUQ4ngqpfQFn7
 NcmFdu+IG66l5ybPh0tpdyytnzJ3czOk5Jw08vg6XrqGBIEe+bw6cOImLFLDmM8vaSgtJG
 ecMWp3nNse7n+91DR1MJPi9OmlDcoRfX+eELLyGocghdEcb9aZNv4hQDkff8LgoSpr/dJ4
 WSzvR/Lokl/zr4oyLTGyr0TA==
Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id a8987525
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Wed, 14 Dec 2022 16:34:50 +0000 (UTC)
References: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
From: Tobias Geerinckx-Rice <me@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#60068] [PATCH 1/2] guix-install.sh: Add
 GUIX_ALLOW_OVERWRITE environment variable.
Date: Wed, 14 Dec 2022 17:16:19 +0100
In-reply-to: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
BIMI-Selector: v=BIMI1; s=default;
Message-ID: <875yeec57z.fsf@nckx>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 60068
Cc: 60068 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi Maxim,

Nice!  More steps towards world domination.

Maxim Cournoyer =E5=86=99=E9=81=93=EF=BC=9A
> +# Environment variables

These sound like they should be command-line arguments.

[=E2=80=A6]

Actually, I'm not totally sold on GUIX_ALLOW_OVERWRITE.  It's not=20
solving much a problem.

Instead, the error message could be specific about what it=20
considers a =E2=80=98previous Guix installation=E2=80=99 =E2=80=94 which wo=
uld be a good=20
idea regardless =E2=80=94 and tell the admin exactly what needs to be=20
removed to continue.

>      "groupadd"
> +    "useradd"

Good catch, but separate patch.  (=E2=99=AA)

> -    if [[ -e "/var/guix" || -e "/gnu" ]]; then
> +    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu)=20
> ]]; then
>          die "A previous Guix installation was found.  Refusing=20
>          to overwrite."
> +    else
> +        _msg "${WAR}Overwriting existing installation!"
>      fi
>=20=20
>      cd "$tmp_path"
> -    tar --extract --file "$pkg" && _msg "${PAS}unpacked=20
> archive"
> -
>      _msg "${INF}Installing /var/guix and /gnu..."
> -    mv "${tmp_path}/var/guix" /var/
> -    mv "${tmp_path}/gnu" /
> +    tar --extract --file "$pkg" -C /

I'm still in favour of using something like =E2=80=98mktemp -d=20
/gnu.XXXXXX=E2=80=99 here if there's no security flaw I missed.  WDYT?

If the overwrite functionality is kept, we should remove the old=20
directories before re-populating them.

Kind regards,

T G-R

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCY5n7kA0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15JYQA/0MC+9Nq+MATmo1+I6w6hw1wcCsFaUR5bzjr3DyO
vmKWAP9ZPyqhLEYgIENx0DPBEz0p8zLD2G/yx5gCCHWgFyEmAA==
=++lV
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Dec 2022 15:56:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 14 10:56:21 2022
Received: from localhost ([127.0.0.1]:40033 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p5U7I-0004aV-Uf
	for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 10:56:21 -0500
Received: from lists.gnu.org ([209.51.188.17]:40690)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1p5U7D-0004aP-Lu
 for submit <at> debbugs.gnu.org; Wed, 14 Dec 2022 10:56:19 -0500
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 <maxim.cournoyer@HIDDEN>)
 id 1p5U7D-0000PD-Ad
 for guix-patches@HIDDEN; Wed, 14 Dec 2022 10:56:15 -0500
Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1p5U7B-0005a5-Mj
 for guix-patches@HIDDEN; Wed, 14 Dec 2022 10:56:15 -0500
Received: by mail-qt1-x833.google.com with SMTP id a16so2758197qtw.10
 for <guix-patches@HIDDEN>; Wed, 14 Dec 2022 07:56:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=M42CaM3Qax3m81KvT4f6PsgNBkAHyWRAS+1HMFRHEtk=;
 b=HFostAR0ZhgCw7CjopHSeTqjQwIhSuHIbUjRNas986ADoGTJh9TaF7br9Yj1nX5jzs
 y+IPNOXTmrKaaH4y2Bw8ViKqAOhuJI4cXF+99EF+JrfNdHNy//Gt3WUTMkTeo6t0X/lc
 sLCoxYWuuguagZ9WaUdDdawGUCObWdkeoeMbP9hXrAr3sKrF5w0H+oaUHMtcVgQtVclJ
 LpTJaRG2y7PQjY/lmgHsAkyNi9lvd7T6sDOnAf0JUL23BD3km8BsyCx6k3rIuVVcNLDA
 HMAc9oG1ezknioyZ3zrYKY8yOJAOVDS1IsW1SHMqRb9IRaM4LcZqRQNraoIceY/u76u7
 A1Qg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=M42CaM3Qax3m81KvT4f6PsgNBkAHyWRAS+1HMFRHEtk=;
 b=BhtxVw4Sy6jrT7PM12Rx2GrXusDWIcPvRcgrUAqc3hvfaZ2hrI5mgF8TrRg8Lw88cg
 azAMHRzGDWrjV6fxY6orMJ5M9nKtaEcuAWtcheCPkvJGnhCCgT8eT99L7GrqrGlG8SJG
 vJ8iduaMy7N9hDS1ZLbGV2dNf/O+9hSqa+4j7AjrQdF++u25m2XXTrpAQ3vIRPRcK4ha
 JXgvd9afhUG0Cf+B8xdPjn7/ECq/0Wu7l6ujh0X4SU8TcWD8RyXqazlBacvy0NLVrXk8
 c7I6Xkom16r3359Xfv7u3N7wrmFGABS5M9br+uPBFuWXzqe2Lcd1YqcOn005UXYt0eBL
 9sQQ==
X-Gm-Message-State: ANoB5plYGDaqx/VeCuJyzA8bITzHi7jg6HqDBuEp+pMJseG/ReyMh7Mq
 ZQFDhKIZnH8GBlOM+ThY0KTBI+wsweZAdQ==
X-Google-Smtp-Source: AA0mqf6Kk27/Ini121UdPJZ5kt+8/u7x0qvDBwkAjhM8sDlWZp9S4zXyPoVFlRKqrpQVqGkizdoC5A==
X-Received: by 2002:ac8:1099:0:b0:3a5:9267:ee07 with SMTP id
 a25-20020ac81099000000b003a59267ee07mr28823747qtj.63.1671033372016; 
 Wed, 14 Dec 2022 07:56:12 -0800 (PST)
Received: from localhost.localdomain ([2607:fad8:4:3::1006])
 by smtp.gmail.com with ESMTPSA id
 k10-20020ac8074a000000b00397b1c60780sm1829150qth.61.2022.12.14.07.56.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Dec 2022 07:56:11 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 1/2] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment
 variable.
Date: Wed, 14 Dec 2022 10:56:02 -0500
Message-Id: <20221214155603.29381-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::833;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qt1-x833.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

The need for this use case appeared when attempting to install Guix on a truly
minimal image made with Buildroot, which lacked enough GNU components that I
had to extract a guix pack to /gnu before attempting installation, which would
then refuse to proceed because of the existing /gnu.

* etc/guix-install.sh: Document environment variables.
(REQUIRE): Add missing "useradd" command.
(sys_create_store) [GUIX_ALLOW_OVERWRITE]: Skip pre-existing installation
checks and output a warning.  Extract the tarball directly to /.
---
 etc/guix-install.sh | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index fb9006b3e2..06730f7e3f 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -29,6 +29,22 @@
 
 # We require Bash but for portability we'd rather not use /bin/bash or
 # /usr/bin/env in the shebang, hence this hack.
+
+# Environment variables
+#
+# GUIX_BINARY_FILE_NAME
+#
+# Can be used to override the automatic download mechanism and point
+# to a local Guix binary archive filename like
+# "/tmp/guix-binary-1.4.0rc2.armhf-linux.tar.xz"
+#
+# GUIX_ALLOW_OVERWRITE
+#
+# Instead of aborting to avoid overwriting a previous installations,
+# allow copying over /var/guix or /gnu.  This can be useful when the
+# installation required the user to extract Guix packs under /gnu to
+# satisfy its dependencies.
+
 if [ "x$BASH_VERSION" = "x" ]
 then
     exec bash "$0" "$@"
@@ -53,6 +69,7 @@ REQUIRE=(
     "chmod"
     "uname"
     "groupadd"
+    "useradd"
     "tail"
     "tr"
     "xz"
@@ -337,16 +354,15 @@ sys_create_store()
 
     _debug "--- [ ${FUNCNAME[0]} ] ---"
 
-    if [[ -e "/var/guix" || -e "/gnu" ]]; then
+    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu) ]]; then
         die "A previous Guix installation was found.  Refusing to overwrite."
+    else
+        _msg "${WAR}Overwriting existing installation!"
     fi
 
     cd "$tmp_path"
-    tar --extract --file "$pkg" && _msg "${PAS}unpacked archive"
-
     _msg "${INF}Installing /var/guix and /gnu..."
-    mv "${tmp_path}/var/guix" /var/
-    mv "${tmp_path}/gnu" /
+    tar --extract --file "$pkg" -C /
 
     _msg "${INF}Linking the root user's profile"
     mkdir -p ~root/.config/guix

base-commit: 1b6e251ed1bae7aa2f544e8ccb6b4aaf872e77e6
-- 
2.38.1





Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#60068; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 14 Dec 2022 21:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.