GNU bug report logs - #58345
[PATCH 0/3] Customize PS1 on foreign distributions

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Fri, 7 Oct 2022 05:28:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#58345: closed ([PATCH 0/3] Customize PS1 on foreign
 distributions)
Date: Fri, 07 Oct 2022 12:30:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 07 Oct 2022 08:28:56 -0400
with message-id <871qrj7r7b.fsf <at> gmail.com>
and subject line Re: [bug#58345] [PATCH 3/3] guix-install.sh: Add Bash prompt customization option.
has caused the debbugs.gnu.org bug report #58345,
regarding [PATCH 0/3] Customize PS1 on foreign distributions
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
58345: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58345
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 0/3] Customize PS1 on foreign distributions
Date: Fri,  7 Oct 2022 01:27:38 -0400
Hi!

The following fixes a usability issue, which is that users entering 'guix
shell' or 'guix environment' would not have any visual feedback in the prompt
about where they are.  I've tested it on three different foreign
distributions, and it worked well on all of them.

Thanks,

Maxim Cournoyer (3):
  guix-install.sh: Improve prompt_yes_no procedure.
  guix-install.sh: Introduce 'die' utility function.
  guix-install.sh: Add Bash prompt customization option.

 etc/guix-install.sh | 69 +++++++++++++++++++++++++++++++--------------
 1 file changed, 48 insertions(+), 21 deletions(-)

-- 
2.37.3



[Message part 3 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 58345-done <at> debbugs.gnu.org
Subject: Re: [bug#58345] [PATCH 3/3] guix-install.sh: Add Bash prompt
 customization option.
Date: Fri, 07 Oct 2022 08:28:56 -0400
Hello,

zimoun <zimon.toutoune <at> gmail.com> writes:

> Hi Maxim,
>
> On ven., 07 oct. 2022 at 01:32, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> wrote:
>> * etc/guix-install.sh (sys_customize_bashrc): New function.
>> (main): Use it.
>
> Nice idea!
>
>> +sys_customize_bashrc()
>> +{
>> +    prompt_yes_no "Customize users Bash shell prompt for Guix?" || return
>> +    for bashrc in /home/*/.bashrc /root/.bashrc; do
>> +        test -f "$bashrc" || continue
>> +        grep -Fq '$GUIX_ENVIRONMENT' "$bashrc" && continue
>> +        cp "${bashrc}" "${bashrc}.bak"
>> +        echo '
>
> Maybe comment, something like:
>
> # Automatically added by Guix install script
>> +if [ -n "$GUIX_ENVIRONMENT" ]; then
>> +    if [[ $PS1 =~ (.*)"\\$" ]]; then
>> +        PS1="${BASH_REMATCH[1]} [env]\\\$ "
>> +    fi
>> +fi
>> +' >> "$bashrc"
>> +    done
>> +    _msg "${PAS}Bash shell prompt successfully customized for Guix"
>> +}

Good idea!  Applied, like:

@@ -575,6 +575,7 @@ sys_customize_bashrc()
         grep -Fq '$GUIX_ENVIRONMENT' "$bashrc" && continue
         cp "${bashrc}" "${bashrc}.bak"
         echo '
+# Automatically added by the Guix install script.
 if [ -n "$GUIX_ENVIRONMENT" ]; then
     if [[ $PS1 =~ (.*)"\\$" ]]; then
         PS1="${BASH_REMATCH[1]} [env]\\\$ "

>
> LGTM!

Alright, the series have been pushed to master, and the script available
at https://guix.gnu.org/install.sh should soon reflect the changes.

Thanks for reviewing!

-- 
Maxim


This bug report was last modified 2 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.