From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oMK1CoDymWNDSwEAbAwnHQ (envelope-from ) for ; Wed, 14 Dec 2022 16:57:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0O1uCoDymWPHVgEAauVa8A (envelope-from ) for ; Wed, 14 Dec 2022 16:57:52 +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 aspmx1.migadu.com (Postfix) with ESMTPS id E695B29218 for ; Wed, 14 Dec 2022 16:57:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5U84-0001Aq-Sb; Wed, 14 Dec 2022 10:57:08 -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 1p5U7z-00018v-N2 for guix-patches@gnu.org; Wed, 14 Dec 2022 10:57:04 -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 1p5U7y-0006Dh-Nf for guix-patches@gnu.org; Wed, 14 Dec 2022 10:57:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5U7y-0004b4-An for guix-patches@gnu.org; Wed, 14 Dec 2022 10:57:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60068] [PATCH 1/2] 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 15:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60068 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60068@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167103338117644 (code B ref -1); Wed, 14 Dec 2022 15:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Dec 2022 15:56:21 +0000 Received: from localhost ([127.0.0.1]:40033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5U7I-0004aV-Uf for submit@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 ) id 1p5U7D-0004aP-Lu for submit@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 ) id 1p5U7D-0000PD-Ad for guix-patches@gnu.org; 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 ) id 1p5U7B-0005a5-Mj for guix-patches@gnu.org; Wed, 14 Dec 2022 10:56:15 -0500 Received: by mail-qt1-x833.google.com with SMTP id a16so2758197qtw.10 for ; 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 Date: Wed, 14 Dec 2022 10:56:02 -0500 Message-Id: <20221214155603.29381-1-maxim.cournoyer@gmail.com> 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@gmail.com; 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-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=1671033472; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=M42CaM3Qax3m81KvT4f6PsgNBkAHyWRAS+1HMFRHEtk=; b=pZLeuq/ty4KFqVgDHBp5Vwup51GAbeRWZGWhM8zx1f3l++7UfZjnnBBSL7COBn/x6u1zF0 PfMiixrOhGHgo21VWEvBuGI6QaAvU0jS/sEl71YzmnEooEog3BxA0xQd1JRTELGK2YFkVu uyoQpKZ/Dl/yFRKspXjxoewIuzJZLOUUma9/JRWUxPuta7aIgg4dONgMoxf0+Q7CZ6fAV5 YBF8BSV16v+FfCAbUALwMobKoWQnY31mq479lekCefAZ/0oQ4B1uP+3+RiboUS8DWTuhCe 7gR/FX98RJm/v0KNhGL2HhJ7TD+XvEaIPZOUnoIWxzonOt+x/bcWjfhrW6Qqtg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=HFostAR0; spf=pass (aspmx1.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=1671033472; a=rsa-sha256; cv=none; b=hQmIRNQBFNSx2uq9EQViW7oo7nstER7YL0WtxmX8mwQ8WjB0NFuZdA9lg/wao38ngjRLzW GpU5R+YqpdL8gdLzoI5lXmP52oqPMz0k994TPVjA044XVsmkosvHW32GIRY74NwR449xkD ZYtZOKP8EhpXYCRQl4MAwhkR8J49P0CI2D7Ne7ciK04D65y4DZIbowWH8DBcQdj/PGDIyI 8x+coDch3M7+x4ybKZJe7/RjXJaBXOsSslv7kG1LRiwlMkhHexwhPRwLyMIus9cAzYUWz9 Jg673zWc6MbHxns8GCrUW95cy4YAJ/xbsmAQq+b8bdUeONp6BwJvb1RxAvgg0Q== X-Migadu-Spam-Score: -1.57 X-Spam-Score: -1.57 X-Migadu-Queue-Id: E695B29218 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=HFostAR0; spf=pass (aspmx1.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: h+neaup9tF6v 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