aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-10-06 23:00:46 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-10-07 08:25:40 -0400
commit9ca0f9e5a9ee0f7aaa86719cc61757734a37eee6 (patch)
treef3464d5f8d1d1f0974e4ae1cffaf119d456dc422 /etc
parent231e5f29ae1f3521442a4e9acf994e999f712f59 (diff)
downloadguix-9ca0f9e5a9ee0f7aaa86719cc61757734a37eee6.tar
guix-9ca0f9e5a9ee0f7aaa86719cc61757734a37eee6.tar.gz
guix-install.sh: Add Bash prompt customization option.
Fixes <https://issues.guix.gnu.org/55484>. * etc/guix-install.sh (sys_customize_bashrc): New function. (main): Use it.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/guix-install.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 29d1c0ba51..f71d6f0de7 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -567,6 +567,24 @@ sys_create_shell_completion()
_msg "${PAS}installed shell completion"
}
+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 '
+# Automatically added by the 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"
+}
welcome()
{
@@ -636,6 +654,7 @@ main()
sys_authorize_build_farms
sys_create_init_profile
sys_create_shell_completion
+ sys_customize_bashrc
_msg "${INF}cleaning up ${tmp_path}"
rm -r "${tmp_path}"