From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eM7CCtDPY2e1HwAA62LTzQ:P1 (envelope-from ) for ; Thu, 19 Dec 2024 07:48:32 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id eM7CCtDPY2e1HwAA62LTzQ (envelope-from ) for ; Thu, 19 Dec 2024 08:48:32 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=L1rZdttQ; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=cQ2Ss5jY; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734594512; 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=kyai9a0xw7doOzBfxMKg5s+5C0JGtZljzpCdMbXiOvo=; b=cn+fj0odZyNGRdz10LXTX4hrEPblAOgOiO6Y5Ce+Qy2uFsUhTRJpVwPnmXL0M9DOZSH+Fk rfnhXkSvNIqtZpf/9COozggJQDA0q2OYAjgaQZA5fO7Dc2WEbuP6VymatwIwEQISRjLwb2 7/nNDf4zsAYTOUdjfN2GQFD9fWaFJGQoDlpsb6VY0LD076CweQDPwQOMMCdUrjaVa6Esb8 vPVXr3eNqIZdqe+iTrZRYeydWZJCi9fyJFgTuj+hexdfsWXHW7Dhn+wIFYHfaRbQJyEgR5 TYMwQ5/3GPoNaerv9tvu1yoHW4FUA6aZyB8C8F71j21mCC+Xn0z1OqJGGl9Trg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734594512; a=rsa-sha256; cv=none; b=U3/wi2inIslUGE4/9wbCU516eN2Go/4HU7nDwx9vmH/JTVV8qWYMpnl5NiSoT7sU+k76bZ MvrMmvT9CnbhYroEBqD+n+MleH5WCoABab5soI7H1mfpL1SEz+k27qnEIuvpsqz7it4G0w uohcyqNWuaSe+iWiNTmdM+lssnoLFwuAOTDC5iBX6tx9eG11c8+lO558EMkGeSJyqtTksm kh+2Ra/MCSDmXpm66Q6XIeSNJC0gDboZuou59nO9YZ13q0wmX+nwWkgWKm3ge42Tndekwq ZpiPOQUcykj5SWAYM+NCs8poPfUYAOAqYcdYFe89bsH3GHeykjrB1aV3NTeKXQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=L1rZdttQ; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=cQ2Ss5jY; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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" 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 A1F3C94CFB for ; Thu, 19 Dec 2024 08:48:31 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOBGQ-0002vV-4K; Thu, 19 Dec 2024 02:48:06 -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 1tOBGN-0002uY-Ul for guix-patches@gnu.org; Thu, 19 Dec 2024 02:48:04 -0500 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 1tOBGN-0002kk-26; Thu, 19 Dec 2024 02:48:03 -0500 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=kyai9a0xw7doOzBfxMKg5s+5C0JGtZljzpCdMbXiOvo=; b=L1rZdttQJjAyRZLN0RN4uJak6wKD4TFwAYBsLrLDztvBGZrfl5yELvqkr8IYXEcTNDolCAcKALDXqwi0C9Dwp4MSN6IqLiZNF55xRn8HDjRNSON9+C4s5XHDTD7JF/KdTmgBWSYLu539EwFKVB/5xCeyLAn+J9dgWGU21rHaj73B1DTDX2hmL7RZXkf5xnnmDgrgAXrfwS/fyuQ18KsjS8nyMCeZFj5SPfS5YJqu+prnGiCk1H4AFhnt8A9pXoUitTPdCBBVRo25/LKw9ztaAPlZFjAS4MAHOd4z6GJvUtVGfUShm1FByo2y6mqr+YK4PffLa/m8768PqUCNYSj5+A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tOBGM-0008IP-SA; Thu, 19 Dec 2024 02:48:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74962] [PATCH v3 3/5] etc/guix-install.sh: Fix quoting and other issues. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: janneke@gnu.org, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, guix-patches@gnu.org Resent-Date: Thu, 19 Dec 2024 07:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74962 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74962@debbugs.gnu.org Cc: Maxim Cournoyer , Janneke Nieuwenhuizen , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe X-Debbugs-Original-Xcc: Janneke Nieuwenhuizen , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe Received: via spool by 74962-submit@debbugs.gnu.org id=B74962.173459444431786 (code B ref 74962); Thu, 19 Dec 2024 07:48:02 +0000 Received: (at 74962) by debbugs.gnu.org; 19 Dec 2024 07:47:24 +0000 Received: from localhost ([127.0.0.1]:37282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOBFk-0008Gb-8H for submit@debbugs.gnu.org; Thu, 19 Dec 2024 02:47:24 -0500 Received: from mail-pj1-f44.google.com ([209.85.216.44]:55530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOBFg-0008G9-6s for 74962@debbugs.gnu.org; Thu, 19 Dec 2024 02:47:20 -0500 Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2ee397a82f6so449741a91.2 for <74962@debbugs.gnu.org>; Wed, 18 Dec 2024 23:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734594379; x=1735199179; darn=debbugs.gnu.org; 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=kyai9a0xw7doOzBfxMKg5s+5C0JGtZljzpCdMbXiOvo=; b=cQ2Ss5jYAnkIvmjJYD7VK6zhrAZSFm7kGimaSbPJSQT1cJB1joV3nJHEmOzMfYQrvF C7xF77k1zvueV63Ssy+XwPjnAJxqYzNs03QLiQLCOpgW2JeKf8gVFw3AvA/c68KD8Gy8 41/STsTMwg5COWWFy9yojrm3WtDPfSkqiKSWXdnCIA9szkT94sWct8P49qSCYHA8OXuW vnEWL58rkfFxvDMW5Oxecb9jtFHjMUG4Xmt9xBLscmfFp+5UV/ABQH+SXH1IVhkQq0Jp 5ygtTckkzklSmUwXnDtJDo5OW4GcoLucuGuin0XbLu4TGs6nenGAiJmL9AbMyb0J4UlT jhVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734594379; x=1735199179; 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=kyai9a0xw7doOzBfxMKg5s+5C0JGtZljzpCdMbXiOvo=; b=C1xRh0pH6mXFNjdcmxyVaBDc/UhlV9c8i9mDISJcEZd0YwePYELNO25gMN33t7/y+3 KGC4c/jRWWlxHsVqewuVJ8HyB57ALi1pQTMQjCvRidb6GX+9ez6eTpLh5JaWDmcTlMlO 9j2/Qy0H2W4nlSZqFVF7IQIXu6bIF+jrBsdFU1D2EOXwvJcESzcXS9jps4iv5Il0bKWG VPoOztFtLPV4Wcx0wC032omo+W2Nf0s8t/j8OnZ/mGOYP2HoXsb2B/Je8oTxphw2jKgx ohosmFlTfDo2rQD4pNNQXYtiosA97+SB/UkH1IeSLsC7q9qGl68Jz2MaG2/ggr+ezEen OfJg== X-Gm-Message-State: AOJu0YwOjcxNz7gI5e0K6Mfr+/QYNxPNtMJPppsr8Iku35YUXE8fRGMU jlDpXRg2SKPg0IaA+a8XXS+0VT1SLGas1Z12iAKFTVn6pOzKMdQbHKISlXctbo8= X-Gm-Gg: ASbGncs5IW5OLyohN8jLEBXvAje5dmysLpUxuGahz0BVYhLHM9FNpT2p//QJlDFXJcr T4dHiND63Xl7kx+VYxVKy1UGhZpbxib1/pVab9YJhAjoo1kF1N5ycykB/pIFJgl/eZf/Z+tAmEJ ZEi0M6cdHvLCD1MgBxy9+SgZf/5iM5UvzI6Pvtn76n9jGh41BU2X2paJvElDsrZzOlmZQYEMQ73 f6VpYqTyXDK3lxjt1vk1i12rNMzY35NOAYrm7jce/jTxNR0lqvoG6zg40T8elZ2oapk5JKq06M= X-Google-Smtp-Source: AGHT+IHaqv47HcSvymHPfH207MP2GkrZff3SOTqz626jSVK3QvdBfl1Xuosm2E5uLrtHUTfnbcEhSg== X-Received: by 2002:a17:90a:f945:b0:2ea:696d:732f with SMTP id 98e67ed59e1d1-2f443d452a9mr3492459a91.29.1734594378657; Wed, 18 Dec 2024 23:46:18 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ed62e390sm2632821a91.21.2024.12.18.23.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 23:46:18 -0800 (PST) From: Maxim Cournoyer Date: Thu, 19 Dec 2024 16:45:31 +0900 Message-ID: <093604124092d3b024127068cbbeff3f9aa62d76.1734594333.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <3d0ccfc5f28f48b0a4e513e4ebfd3018c85b4407.1734594333.git.maxim.cournoyer@gmail.com> References: <3d0ccfc5f28f48b0a4e513e4ebfd3018c85b4407.1734594333.git.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -2.67 X-Spam-Score: -2.67 X-Migadu-Queue-Id: A1F3C94CFB X-TUID: q97ymq7fLcMr This change fixes most issues reported by the 'shellcheck' command. * etc/guix-install.sh (add_init_sys_require): Use -n instead of ! -z. (sys_create_build_user): Quote variable expansion. (sys_delete_build_user): Likewise. (sys_create_shell_completion): Likewise. (sys_delete_user_profiles): Likewise. (sys_delete_guix_daemon): Explicitly access first array item. (sys_create_store): Update shellcheck code to ignore. (SYSV_INIT_REQUIRE): Ignore unused warning. (sys_customize_bashrc): Ignore warnings due to using variables inside a literal. (main): Replace $@ with $* inside string. Change-Id: Ia88509b461b3844f2dd5abf9fb21a5b2bbb8a1e1 --- Changes in v3: - Add comments to avoid remaining shellcheck warnings. etc/guix-install.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 481eb6f12a..8d3d9d224b 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -77,6 +77,7 @@ REQUIRE=( # Add variables using form FOO_INIT_REQUIRE when init system FOO dependencies # should be checked. +# shellcheck disable=SC2034 # the variable name is computed SYSV_INIT_REQUIRE=( "daemonize" ) @@ -151,7 +152,7 @@ chk_require() add_init_sys_require() { # Add the elements of FOO_INIT_SYS to REQUIRE local init_require="${INIT_SYS}_REQUIRE[@]" - if [[ ! -z "$init_require" ]]; then + if [[ -n "$init_require" ]]; then # Have to add piecemeal because ${!foo[@]} performs direct array key # expansion, not indirect plain array expansion. for r in "${!init_require}"; do @@ -390,7 +391,7 @@ sys_create_store() ~root/.config/guix/current GUIX_PROFILE=~root/.config/guix/current - # shellcheck disable=SC1090 + # shellcheck disable=SC1091 source "${GUIX_PROFILE}/etc/profile" _msg "${PAS}activated root profile at ${GUIX_PROFILE}" } @@ -427,12 +428,12 @@ sys_create_build_user() for i in $(seq -w 1 10); do if id "guixbuilder${i}" &>/dev/null; then _msg "${INF}user is already in the system, reset" - usermod -g guixbuild -G guixbuild${KVMGROUP} \ + usermod -g guixbuild -G "guixbuild${KVMGROUP}" \ -d /var/empty -s "$(which nologin)" \ -c "Guix build user $i" \ "guixbuilder${i}"; else - useradd -g guixbuild -G guixbuild${KVMGROUP} \ + useradd -g guixbuild -G "guixbuild${KVMGROUP}" \ -d /var/empty -s "$(which nologin)" \ -c "Guix build user $i" --system \ "guixbuilder${i}"; @@ -445,7 +446,7 @@ sys_delete_build_user() { for i in $(seq -w 1 10); do if id -u "guixbuilder${i}" &>/dev/null; then - userdel -f guixbuilder${i} + userdel -f "guixbuilder${i}" fi done @@ -551,7 +552,7 @@ sys_delete_guix_daemon() local local_bin local var_guix - _debug "--- [ $FUNCNAME ] ---" + _debug "--- [ ${FUNCNAME[0]} ] ---" info_path="/usr/local/share/info" local_bin="/usr/local/bin" @@ -681,7 +682,7 @@ sys_create_shell_completion() { # Just in case for dir_shell in $bash_completion $zsh_completion $fish_completion; do - [ -d "$dir_shell" ] || mkdir -p $dir_shell + [ -d "$dir_shell" ] || mkdir -p "$dir_shell" done; ln -sf ${var_guix}/etc/bash_completion.d/* "$bash_completion"; @@ -696,8 +697,10 @@ sys_customize_bashrc() for bashrc in /home/*/.bashrc /root/.bashrc; do test -f "$bashrc" || continue + # shellcheck disable=SC2016 # checking for literal $GUIX_ENVIRONMENT grep -Fq '$GUIX_ENVIRONMENT' "$bashrc" && continue cp "${bashrc}" "${bashrc}.bak" + # shellcheck disable=SC2016,SC2028 # that's also a string literal echo ' # Automatically added by the Guix install script. if [ -n "$GUIX_ENVIRONMENT" ]; then @@ -747,10 +750,10 @@ sys_delete_user_profiles() rm -rf ~root/.cache/guix _msg "${INF}removing .guix-profile, .cache/guix and .config/guix of all /home users" - for user in `ls -1 /home`; do - rm -f /home/$user/.guix-profile - rm -rf /home/$user/.cache/guix - rm -rf /home/$user/.config/guix + for user in /home/*; do + rm -f "/home/$user/.guix-profile" + rm -rf "/home/$user/.cache/guix" + rm -rf "/home/$user/.config/guix" done } @@ -898,7 +901,7 @@ main() if [ '--uninstall' = "${uninstall_flag}" ]; then main_uninstall else - echo "unsupported parameters: $@" + echo "unsupported parameters: $*" exit 1 fi fi -- 2.46.0