From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sIEHHPTGeF/jbQAA0tVLHw (envelope-from ) for ; Sat, 03 Oct 2020 18:46:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id sMTvF/TGeF8qOAAA1q6Kng (envelope-from ) for ; Sat, 03 Oct 2020 18:46:12 +0000 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 CA1259401DF for ; Sat, 3 Oct 2020 18:46:11 +0000 (UTC) Received: from localhost ([::1]:50634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOmXq-0002rU-Fk for larch@yhetil.org; Sat, 03 Oct 2020 14:46:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOmXi-0002qq-IK for guix-patches@gnu.org; Sat, 03 Oct 2020 14:46:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:32933) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOmXi-00022y-78 for guix-patches@gnu.org; Sat, 03 Oct 2020 14:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kOmXi-0001i7-5K for guix-patches@gnu.org; Sat, 03 Oct 2020 14:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43769] [PATCH v2 1/2] guix-install.sh: Add symbolic links for supported shell completions. References: <20201002173537.12045-1-zimon.toutoune@gmail.com> In-Reply-To: <20201002173537.12045-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 03 Oct 2020 18:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43769 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43769@debbugs.gnu.org Cc: zimoun Received: via spool by 43769-submit@debbugs.gnu.org id=B43769.16017507176512 (code B ref 43769); Sat, 03 Oct 2020 18:46:02 +0000 Received: (at 43769) by debbugs.gnu.org; 3 Oct 2020 18:45:17 +0000 Received: from localhost ([127.0.0.1]:44476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOmWz-0001gy-D3 for submit@debbugs.gnu.org; Sat, 03 Oct 2020 14:45:17 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOmWy-0001gj-9b for 43769@debbugs.gnu.org; Sat, 03 Oct 2020 14:45:16 -0400 Received: by mail-wr1-f67.google.com with SMTP id c18so5273194wrm.9 for <43769@debbugs.gnu.org>; Sat, 03 Oct 2020 11:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mgh8dKasq3+vOzIuIwjf2DrH98ynWraV+PKajWQUtwc=; b=f1d2zGXiAwZkPI9hctND+8jgUu6/QJf9RoiLWSbGoYXdto0amBCjAvsepWwRTALSvw +AHvj7T50Oe3e2YP1YCYFs1ZwRhVwjlugkRA/yRjP83u2EPOQ+T/mrS3gthKXsUxMLVg GVcOwz1l4uJYOmGwDFsFV3Nt0DqJckRIDbqRuPqAPd31F4cLJnQXAPGNJANgulSVZvtp FGpBirSQMd6EfDEfQkwrhm4S1ikAmgJdI+7HE1qbcaJ7ICv6Wy0uOqPYunTDxrXGUb/x PLZPmNviz/z+GkhnWVGyAdkpJPBg8wKsY3pJIel4ZOWyRr0PtK7s0IA/Q23tGS1Txryv +a3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mgh8dKasq3+vOzIuIwjf2DrH98ynWraV+PKajWQUtwc=; b=B+/v/wMwdOh+QxiSECFUIp2ooZpqzNs7032IYthXU9ytNIWuO6A6HmRX+GQxy0nOhY 6yqmmdMJiCCLdqs8pi76ymXkzgkHiB5cyqiRhKn/PM+h3hK10ZIYqFddSc/Q6eoaZRll 60aHdFt8gvxDEaoxXg3+or4bMjP92ji5pcikvdaEv/U8FLi+HXSmUkmyPsY0vylz/gzS sIvtQSXb0q9UUNWUdT9810RWVuE0roKa6moiD8rMxFdKXpqBLCaLCI0lzBa4AMr6iWnJ R3s0+uV2YeW9M1GrmjJ3XqaClbMCgw/7fZLHOhEVgqKYYqP2v0qFYeyOnWXlPgAs92M/ KatQ== X-Gm-Message-State: AOAM531fjmE2uTNgKtZHrTWnJi3QeSOhF/W2UxxH8yUGZS6JzHJehFE2 ARiD/0L7s7ydHRKuuR0zYfoESsb+b+Y= X-Google-Smtp-Source: ABdhPJxe7nkK0+tUQa1Q6cdwcz4+zeHjzRHuN1TaQzhJ3JfOjwt/oEbmiS5p8+aK5LYLCtP/dC/AQQ== X-Received: by 2002:adf:f986:: with SMTP id f6mr8803075wrr.270.1601750710016; Sat, 03 Oct 2020 11:45:10 -0700 (PDT) Received: from lili.univ-paris-diderot.fr ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id u81sm2993224wmg.43.2020.10.03.11.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 11:45:09 -0700 (PDT) From: zimoun Date: Sat, 3 Oct 2020 20:44:46 +0200 Message-Id: <20201003184447.9542-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=f1d2zGXi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: EArLu1L1NL0c Fixes . * etc/guix-install.sh (sys_create_shell_completion): New function to add system wide all the symlinks for supported shell completions. --- etc/guix-install.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/etc/guix-install.sh b/etc/guix-install.sh index eb7205a261..a5da198eb0 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -5,6 +5,7 @@ # Copyright © 2018 Efraim Flashner # Copyright © 2019, 2020 Tobias Geerinckx-Rice # Copyright © 2020 Morgan Smith +# Copyright © 2020 Simon Tournier # # This file is part of GNU Guix. # @@ -459,6 +460,36 @@ export XDG_DATA_DIRS="$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/share/:/us EOF } +sys_create_shell_completion() +{ # Symlink supported shell completions system-wide + + var_guix=/var/guix/profiles/per-user/root/current-guix + bash_completion=/etc/bash_completion.d + zsh_completion=/usr/share/zsh/site-functions + fish_completion=/usr/share/fish/vendor_completions.d + + while true; do + read -p "Install shell completion? (yes/no)" yn + case $yn in + [Yy]*) + { # Just in case + for dir_shell in $bash_completion $zsh_completion $fish_completion; do + [ -d "$dir_shell" ] || mkdir -p $dir_shell + done; + + ln -sf ${var_guix}/etc/bash_completion.d/* "$bash_completion"; + ln -sf ${var_guix}/share/zsh/site-functions/* "$zsh_completion"; + ln -sf ${var_guix}/share/fish/vendor_completions.d/* "$fish_completion"; } && + _msg "${PAS}Installed shell completion" + break;; + [Nn]*) _msg "${INF}Skipped shell completion installation" + break;; + *) _msg "Please answer yes or no."; + esac + done +} + + welcome() { cat<<"EOF" @@ -516,6 +547,7 @@ main() sys_enable_guix_daemon sys_authorize_build_farms sys_create_init_profile + sys_create_shell_completion _msg "${INF}cleaning up ${tmp_path}" rm -r "${tmp_path}" -- 2.28.0