profile.d: Prevent setting VTE-specific PROMPT_COMMAND without VTE

Fedora's /etc/bashrc sets the PROMPT_COMMAND environment variable to
__vte_prompt_command when running inside a VteTerminal. This becomes a
problem if the __vte_prompt_command shell function is missing because
/etc/profile.d/vte.sh itself is absent [1], which is the case with the
Red Hat Universal Base Image.

This tricks the code in /etc/bashrc into not doing that.

[1] https://pagure.io/setup/pull-request/23

https://github.com/containers/toolbox/pull/667
This commit is contained in:
Debarshi Ray 2021-01-12 02:28:54 +01:00
parent 32d711cc64
commit 6fa2184da5

View file

@ -55,6 +55,14 @@ if [ -f /run/.containerenv ] \
touch "$toolbox_welcome_stub"
fi
if ! [ -f /etc/profile.d/vte.sh ] && [ -z "$PROMPT_COMMAND" ] && [ "${VTE_VERSION:-0}" -ge 3405 ]; then
case "$TERM" in
xterm*|vte*)
[ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND=" "
;;
esac
fi
if [ "$TERM" != "" ]; then
error_message="Error: terminfo entry not found for $TERM"
term_without_first_character="${TERM#?}"