From patchwork Thu Feb 6 04:25:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Hupfer X-Patchwork-Id: 38303 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BC0BC27BBEA; Thu, 6 Feb 2025 04:27:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2D1D427BBE2 for ; Thu, 6 Feb 2025 04:27:25 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tftTz-0000SG-BE; Wed, 05 Feb 2025 23:27: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 1tftTm-0000Op-LH for guix-patches@gnu.org; Wed, 05 Feb 2025 23:27:06 -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 1tftTk-00017d-BP; Wed, 05 Feb 2025 23:27:05 -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=pXoYAJ2jkuSbXIr5MzMfJw48oFj2bqK+SfPywCZ580Q=; b=tEl6+PJ1atQTcjYUTeDELRVH6+04I5b2yvSgXGfh4imhNLI/ttBb+sLUO7js/709+wYXMoVrgElJq9n12v6RcA03nxR6l61AL7o7vo+OIS+x4XtiIgiveHgK+gn+pQf7n9G2j46NYpUDKPnfH7SL8+P3K2k34o5OfW6lLs265vN6X81in4mf9KA0VGfp9NAiGB4kPWoJAne/AtfkjzJaUlM+cGF8yPQV+pGqZoX5Rhwr44Y2qwFOzusrsBSkRPEE6n6SNwYejX9OpNC/28AVZJyBVELX/MQIpS9ctFNryQvVs70XeX3KO0SKoVsvdaZrjBunaDvjc7+9c8vi9pQMlQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tftTk-0002Xn-6P; Wed, 05 Feb 2025 23:27:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76082] [PATCH 7/9] guix-install.sh: Appease shellcheck. Resent-From: Liam Hupfer Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Feb 2025 04:27:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76082 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76082@debbugs.gnu.org Cc: Liam Hupfer , Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour , Vagrant Cascadian X-Debbugs-Original-Xcc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour , Vagrant Cascadian Received: via spool by 76082-submit@debbugs.gnu.org id=B76082.17388159929645 (code B ref 76082); Thu, 06 Feb 2025 04:27:04 +0000 Received: (at 76082) by debbugs.gnu.org; 6 Feb 2025 04:26:32 +0000 Received: from localhost ([127.0.0.1]:53628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tftTD-0002VV-Rj for submit@debbugs.gnu.org; Wed, 05 Feb 2025 23:26:32 -0500 Received: from out-188.mta0.migadu.com ([2001:41d0:1004:224b::bc]:11198) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tftTC-0002Uz-4n for 76082@debbugs.gnu.org; Wed, 05 Feb 2025 23:26:30 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpfr.net; s=key1; t=1738815983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pXoYAJ2jkuSbXIr5MzMfJw48oFj2bqK+SfPywCZ580Q=; b=q68/6+saT8ez+8t8bWolrZjilPP1ob/XIzOM1KE7wtQ40Ztt4FaZtxCMRXPXPaCtVuUck5 EuTsi2qEoeo4mW9M8vxG9JSI6JnSnmTdk4QJgpCEG4Od6IkEtJEBApk4qSwdtSYmEvC4rQ 4tuY01bPViTs+WWKe83J2RzO/qGAexwhU5eI+Ga1wWcJpA3YKYIz9gVTOuUGQFNmABpDzg Vs2HpyLJWdFB2s1bspB8OnjuOuztA1367ilwboeT6QELSfLENc8lwAKxcWs+VsRQmR9rq6 Aey0CAfSsP5mmXBhs/cftGY0N2+bFM0E65sVWPaaeHsFouIFfBJJ+j1NCUzSXQ== From: Liam Hupfer Date: Wed, 5 Feb 2025 22:25:03 -0600 Message-ID: <470303f6526912c2f03a4661c0e4afa8aa538b4e.1738815703.git.liam@hpfr.net> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * etc/guix-install.sh: Appease shellcheck. Change-Id: I24f0d13bb254c08d4fe45f5aa3b74bbc6a9a9d88 --- etc/guix-install.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/etc/guix-install.sh b/etc/guix-install.sh index ef338e89f7..340c3a394f 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -51,8 +51,8 @@ # installation required the user to extract Guix packs under /gnu to # satisfy its dependencies. -if [ "x$BASH_VERSION" = "x" ] -then +# shellcheck disable=2268 # try to support vintage shells +if [ "x$BASH_VERSION" = "x" ]; then exec bash "$0" "$@" fi @@ -85,6 +85,7 @@ REQUIRE=( # Add variables using form FOO_INIT_REQUIRE when init system FOO dependencies # should be checked. +# shellcheck disable=2034 # interpolated by add_init_sys_require SYSV_INIT_REQUIRE=( "daemonize" ) @@ -159,7 +160,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 @@ -398,7 +399,9 @@ sys_create_store() ~root/.config/guix/current GUIX_PROFILE=~root/.config/guix/current - # shellcheck disable=SC1090 + # The profile just prepends to search paths, which is not needed for + # effective linting. + # shellcheck disable=SC1091 source "${GUIX_PROFILE}/etc/profile" _msg "${PAS}activated root profile at ${GUIX_PROFILE}" } @@ -435,12 +438,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}"; @@ -453,7 +456,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 @@ -559,7 +562,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" @@ -703,7 +706,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; # Don't use globing here as we also need to delete the files when @@ -737,8 +740,10 @@ sys_customize_bashrc() for bashrc in /home/*/.bashrc /root/.bashrc; do test -f "$bashrc" || continue + # shellcheck disable=SC2016 # intended search for variable reference grep -Fq '$GUIX_ENVIRONMENT' "$bashrc" && continue cp "${bashrc}" "${bashrc}.bak" + # shellcheck disable=SC2016,SC2028 # intended literal shell output echo ' # Automatically added by the Guix install script. if [ -n "$GUIX_ENVIRONMENT" ]; then @@ -788,11 +793,7 @@ 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 - done + rm -rf /home/*/{.guix-profile,{.cache,.config}/guix} } welcome() @@ -940,7 +941,7 @@ main() if [ '--uninstall' = "${uninstall_flag}" ]; then main_uninstall else - echo "unsupported parameters: $@" + echo "unsupported parameters: $*" exit 1 fi fi