2021-01-19 18:00:21 +00:00
|
|
|
# shellcheck shell=sh
|
|
|
|
|
2021-05-26 22:13:18 +00:00
|
|
|
# shellcheck disable=SC2153
|
2021-11-25 16:30:53 +00:00
|
|
|
[ "${BASH_VERSION:-}" != "" ] || [ "${ZSH_VERSION:-}" != "" ] || return 0
|
2019-04-24 17:36:36 +00:00
|
|
|
[ "$PS1" != "" ] || return 0
|
|
|
|
|
|
|
|
toolbox_config="$HOME/.config/toolbox"
|
|
|
|
host_welcome_stub="$toolbox_config/host-welcome-shown"
|
2019-04-25 14:20:34 +00:00
|
|
|
toolbox_welcome_stub="$toolbox_config/toolbox-welcome-shown"
|
2019-04-24 17:36:36 +00:00
|
|
|
|
2020-11-13 18:54:04 +00:00
|
|
|
# shellcheck disable=2046
|
2021-01-06 18:58:38 +00:00
|
|
|
# shellcheck disable=SC1091
|
2020-11-13 18:54:04 +00:00
|
|
|
eval $(
|
2021-02-10 17:15:13 +00:00
|
|
|
if [ -f /etc/os-release ]; then
|
|
|
|
. /etc/os-release
|
|
|
|
else
|
|
|
|
. /usr/lib/os-release
|
|
|
|
fi
|
2020-11-13 18:54:04 +00:00
|
|
|
|
|
|
|
echo ID="$ID"
|
|
|
|
echo VARIANT_ID="$VARIANT_ID"
|
|
|
|
)
|
2019-08-09 14:24:08 +00:00
|
|
|
|
2019-04-24 17:36:36 +00:00
|
|
|
if [ -f /run/ostree-booted ] \
|
2019-08-09 14:24:08 +00:00
|
|
|
&& ! [ -f "$host_welcome_stub" ] \
|
|
|
|
&& [ "${ID}" = "fedora" ] \
|
2021-09-21 23:13:51 +00:00
|
|
|
&& { [ "${VARIANT_ID}" = "workstation" ] || [ "${VARIANT_ID}" = "silverblue" ] || [ "${VARIANT_ID}" = "kinoite" ]; }; then
|
2019-04-24 17:36:36 +00:00
|
|
|
echo ""
|
2021-09-21 23:13:51 +00:00
|
|
|
# shellcheck disable=SC3059
|
|
|
|
echo "Welcome to Fedora ${VARIANT_ID^}. This terminal is running on the"
|
2019-07-13 17:40:01 +00:00
|
|
|
echo "host system. You may want to try out the Toolbox for a directly"
|
|
|
|
echo "mutable environment that allows package installation with DNF."
|
2019-04-24 17:36:36 +00:00
|
|
|
echo ""
|
|
|
|
printf "For more information, see the "
|
|
|
|
# shellcheck disable=SC1003
|
|
|
|
printf '\033]8;;https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/\033\\documentation\033]8;;\033\\'
|
|
|
|
printf ".\n"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
mkdir -p "$toolbox_config"
|
|
|
|
touch "$host_welcome_stub"
|
|
|
|
fi
|
|
|
|
|
2019-04-25 14:20:34 +00:00
|
|
|
if [ -f /run/.containerenv ] \
|
2019-05-03 17:33:37 +00:00
|
|
|
&& [ -f /run/.toolboxenv ]; then
|
2021-11-25 17:08:31 +00:00
|
|
|
[ "${BASH_VERSION:-}" != "" ] && PS1=$(printf "\[\033[35m\]⬢\[\033[0m\]%s" "[\u@\h \W]\\$ ")
|
|
|
|
[ "${ZSH_VERSION:-}" != "" ] && PS1=$(printf "\033[35m⬢\033[0m%s" "[%n@%m]%~%# ")
|
2019-04-25 14:20:34 +00:00
|
|
|
|
2019-05-03 12:46:36 +00:00
|
|
|
if ! [ -f "$toolbox_welcome_stub" ]; then
|
|
|
|
echo ""
|
|
|
|
echo "Welcome to the Toolbox; a container where you can install and run"
|
|
|
|
echo "all your tools."
|
|
|
|
echo ""
|
2021-02-10 17:14:52 +00:00
|
|
|
|
|
|
|
if [ "${ID}" = "fedora" ]; then
|
|
|
|
echo " - Use DNF in the usual manner to install command line tools."
|
|
|
|
echo " - To create a new tools container, run 'toolbox create'."
|
|
|
|
echo ""
|
|
|
|
printf "For more information, see the "
|
|
|
|
# shellcheck disable=SC1003
|
|
|
|
printf '\033]8;;https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/\033\\documentation\033]8;;\033\\'
|
|
|
|
printf ".\n"
|
|
|
|
else
|
|
|
|
echo " - To create a new tools container, run 'toolbox create'."
|
|
|
|
fi
|
|
|
|
|
2019-05-03 12:46:36 +00:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
mkdir -p "$toolbox_config"
|
|
|
|
touch "$toolbox_welcome_stub"
|
|
|
|
fi
|
2020-08-28 15:25:57 +00:00
|
|
|
|
2021-01-12 01:28:54 +00:00
|
|
|
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
|
|
|
|
|
2020-08-28 15:25:57 +00:00
|
|
|
if [ "$TERM" != "" ]; then
|
|
|
|
error_message="Error: terminfo entry not found for $TERM"
|
|
|
|
term_without_first_character="${TERM#?}"
|
|
|
|
term_just_first_character="${TERM%$term_without_first_character}"
|
|
|
|
terminfo_sub_directory="$term_just_first_character/$TERM"
|
|
|
|
|
|
|
|
if [ "$TERMINFO" = "" ]; then
|
|
|
|
! [ -e "/usr/share/terminfo/$terminfo_sub_directory" ] \
|
2020-10-01 19:29:14 +00:00
|
|
|
&& ! [ -e "/lib/terminfo/$terminfo_sub_directory" ] \
|
2020-08-28 15:25:57 +00:00
|
|
|
&& ! [ -e "$HOME/.terminfo/$terminfo_sub_directory" ] \
|
|
|
|
&& echo "$error_message" >&2
|
|
|
|
else
|
|
|
|
! [ -e "$TERMINFO/$terminfo_sub_directory" ] \
|
|
|
|
&& echo "$error_message" >&2
|
|
|
|
fi
|
|
|
|
fi
|
2019-04-25 14:20:34 +00:00
|
|
|
fi
|
|
|
|
|
2019-04-24 17:36:36 +00:00
|
|
|
unset toolbox_config
|
|
|
|
unset host_welcome_stub
|
2019-04-25 14:20:34 +00:00
|
|
|
unset toolbox_welcome_stub
|