From 678a0e030366b5c33a44d8f5b42c12cdc3aa3f60 Mon Sep 17 00:00:00 2001 From: Javier Jardon Date: Wed, 1 Apr 2015 15:30:28 +0000 Subject: strata/core/bash.morph: Add configuration file /etc/bash.bashrc This will: - Enable bash autocompletion if it's installed - Reset the terminal title when exit the current process Change-Id: Ic46a1edd1f84cf54f189956559344a85d8b64638 --- strata/core/bash.morph | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/strata/core/bash.morph b/strata/core/bash.morph index 9639593b..5d0b8f03 100644 --- a/strata/core/bash.morph +++ b/strata/core/bash.morph @@ -1,8 +1,37 @@ name: bash kind: chunk +build-system: autotools configure-commands: -- ./configure --prefix=/usr --bindir=/bin --without-bash-malloc --with-installed-readline -build-commands: -- make -install-commands: -- make DESTDIR="$DESTDIR" install +- | + export CFLAGS="${CFLAGS} -DSYS_BASHRC='\"/etc/bash.bashrc\"'"; + ./configure --prefix="$PREFIX" \ + --bindir=/bin \ + --without-bash-malloc \ + --with-installed-readline \ + --enable-readline +post-install-commands: +- | + cat <<'EOF' >> bash.bashrc + # + # /etc/bash.bashrc + # + + # If not running interactively, don't do anything + [[ $- != *i* ]] && return + + # Configure prompt for different terminals + case ${TERM} in + xterm*|rxvt*|Eterm|aterm|kterm|gnome*) + PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' + + ;; + screen) + PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' + ;; + esac + + # Enable bash completion if present + [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion + EOF +- mkdir -p "$DESTDIR"/etc +- install -m 644 bash.bashrc "$DESTDIR"/etc/bash.bashrc -- cgit v1.2.1