guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58345: [PATCH 3/3] guix-install.sh: Add Bash prompt customization op


From: Maxim Cournoyer
Subject: bug#58345: [PATCH 3/3] guix-install.sh: Add Bash prompt customization option.
Date: Fri, 07 Oct 2022 08:28:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hello,

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

> Hi Maxim,
>
> On ven., 07 oct. 2022 at 01:32, Maxim Cournoyer <maxim.cournoyer@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]