From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 kHZAIkwVmmNvowAAbAwnHQ (envelope-from ) for ; Wed, 14 Dec 2022 19:26:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id uMhTIUwVmmO77wAAG6o9tA (envelope-from ) for ; Wed, 14 Dec 2022 19:26:20 +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 3576B1150 for ; Wed, 14 Dec 2022 19:26:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5WSF-0002xI-0W; Wed, 14 Dec 2022 13:26:07 -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 1p5WSB-0002w2-CC for guix-patches@gnu.org; Wed, 14 Dec 2022 13:26: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 1p5WSB-0004dV-3w for guix-patches@gnu.org; Wed, 14 Dec 2022 13:26:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5WSA-0006Ep-Q9 for guix-patches@gnu.org; Wed, 14 Dec 2022 13:26: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 18:26: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: Tobias Geerinckx-Rice Cc: 60068@debbugs.gnu.org X-Debbugs-Original-Cc: 60068@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by 60068-submit@debbugs.gnu.org id=B60068.167104231723958 (code B ref 60068); Wed, 14 Dec 2022 18:26:02 +0000 Received: (at 60068) by debbugs.gnu.org; 14 Dec 2022 18:25:17 +0000 Received: from localhost ([127.0.0.1]:40832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5WRR-0006EM-H3 for submit@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 ) id 1p5WRN-0006Dz-54 for 60068@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@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 References: <20221214155603.29381-1-maxim.cournoyer@gmail.com> <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@gmail.com> 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-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=1671042380; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=ovMA1yYudgloTuA9/nVOFX5koLSSm+x//KFueCR8NfA=; b=OgoHT704ahPZDhIwIbUCo2/tWmyYnipgYOHzquI/mOHk+djEx69oaQP4j9qk1DOUwFxgzW SGMtQeR7dU2/+CpkwE1r7A8u5QeZ+C0UzW6gwluRWghVuLLptZOuDFFdp1vs0vK3bF0Uy3 Mb45qeNP0ZSSPhsCaxZTIK6NT5J77jYF7zQhi+W9dYmgzzqeiPK4sCWWI2vWAlA5lXxjDS IyXOVx6nxzBGXS8yWBVNJ+qdGDHlVELl3et8W7YEAw7n6xhFDq3zVs4Du0B8Ny35GnWHYM i/j1C2WuVqpBGKcr0rhxhJdFO+wD1hV+I7muPPpue8b3WaY2STu7y3Vvsh6GHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=JPx4+mhX; 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=1671042380; a=rsa-sha256; cv=none; b=sBbsnZiezO1osLoYuwdHoVtj7K7o0qiGAH44tPf2b3Iu2VtWzqjmsuojFk0hZUdFFqxAiE rqPKstgStC0a5d6OPNCj5hJC+k8G6W/o9xsn2hw0jBBYf5L+FaeCbWWK7y5qJ3U3lZcEvL XQhrQ6X/SiOG+cxlF4Z5zZWYwgPOljkozsbWZgbNnyGx22QR7kyvnzQngKQJxIgTcI1sE6 9x5sGPFtuvCkHI8ju9ooKxqNaBTyKbHkrj1OjS5+yMgKzwcseJfmQdAeqhUJ7xu0Rzm2FO ACxNmECibQO4Ji79HZSckCL6ucHEdQXWsihC2os49tCt2VF/82sN+nZ0ScAoww== X-Migadu-Spam-Score: 4.93 X-Spam-Score: 4.93 X-Migadu-Queue-Id: 3576B1150 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=JPx4+mhX; 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: 2WhcT+X/kCCy Hi Tobias, Tobias Geerinckx-Rice 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