From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id UHnEElk2mmM1KAEAbAwnHQ (envelope-from ) for ; Wed, 14 Dec 2022 21:47:21 +0100 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qHmKElk2mmNqHQAAauVa8A (envelope-from ) for ; Wed, 14 Dec 2022 21:47:21 +0100 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 aspmx2.migadu.com (Postfix) with ESMTPS id 0AD3335141 for ; Wed, 14 Dec 2022 21:47:21 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5Yee-0005Kn-CR; Wed, 14 Dec 2022 15:47:04 -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 ) id 1p5Yec-0005K0-PL for guix-patches@gnu.org; Wed, 14 Dec 2022 15:47:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5Yec-00016M-Hd for guix-patches@gnu.org; Wed, 14 Dec 2022 15:47:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5Yec-0004DM-Cn for guix-patches@gnu.org; Wed, 14 Dec 2022 15:47:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60068] [PATCH v2 2/3] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment variable. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 14 Dec 2022 20:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60068 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60068@debbugs.gnu.org Cc: me@tobias.gr, Maxim Cournoyer Received: via spool by 60068-submit@debbugs.gnu.org id=B60068.167105082116191 (code B ref 60068); Wed, 14 Dec 2022 20:47:02 +0000 Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 20:47:01 +0000 Received: from localhost ([127.0.0.1]:41787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5Yeb-0004D0-0m for submit@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 ) id 1p5YeZ-0004Ch-3b for 60068@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@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 Date: Wed, 14 Dec 2022 15:46:39 -0500 Message-Id: <20221214204640.16879-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221214204640.16879-1-maxim.cournoyer@gmail.com> References: <20221214204640.16879-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671050841; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Un0fZJVaLUxbKw8DTSotXo0HP/nDyh/LNRYFXBJIEhQ=; b=j0X1Y7H8UBN+zoaTXSnq614pblDTKDHweMZxVVMA8Yiz8wpmCX3Jmsn9tIqk7Qp70rIUoi tX1n2uwD8t2insVVj7jr6FI3+Y8yTipIKeMku2tUo1EEOLgZQDw444PWj9EWNL5PQocJ9m sLfGdHYHIVKHvniyJckIB5goQfe2/MY8MQLiiIssV88bQHMcQjNdOkdVh5uh+Bf1dpe6V+ 94pmVaOB8XqrK0/zcLfmdEW30g0tYuMz9MXz4YXmb0FrJG2wS3qo5tA39NZgA5xdnjL5jP 9np/JgYp5knuaN9HcrOIQf778vPXbmJVGHejw+NmZ3D6n2vHHyoWmy/5GjSzbg== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=nJdd2Va1; spf=pass (aspmx2.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671050841; a=rsa-sha256; cv=none; b=SIHDdxV/EQBO/8TaXBzQ2HS8EATG8gZ3EbyqVKekyAhaebo/YStRm1pTHelTQKTrUTqVCl rnbXi5fdvWyqrmDq06PkpPH6hOwte96Z3/C22wp2MbtyuS03xam7m2ImVV5hfayW8Uvgvt JnnoOEGkwvYrBXnX1aoRoDbu6tXGsMdJT0T52L2hgU2lCq0xYWrrLdqg7ExoLqLiPXkgel yUAL25dbGVvR2Rh3PmMqnUV17W/Kk7yiIMkNMkAMx3Fm7zW5VG+MDcQIrvlLB8h6LUQA48 F27T4QXPYPKDZEKH/JZGsQ/Gu/7osJGMcwTSc8FPefmxoar174ACjnBqKZyv0A== X-Migadu-Spam-Score: 5.93 X-Spam-Score: 5.93 X-Migadu-Queue-Id: 0AD3335141 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=nJdd2Va1; spf=pass (aspmx2.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) X-TUID: CM4Z5KW8LIks 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