Move container tooling to toolbox subdir
This commit is contained in:
13
toolbox/profile.d/99-aliases.sh
Normal file
13
toolbox/profile.d/99-aliases.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
alias dnf='echo "WARNING: Package installs should require a toolbox rebuild, use dnf-local to override"'
|
||||
alias dnf-local='command dnf'
|
||||
|
||||
alias prun="poetry run"
|
||||
alias psync="poetry install --sync"
|
||||
alias code='codium'
|
||||
alias ssh='ssh -F ~/.ssh/config'
|
||||
|
||||
alias bk='cd -'
|
||||
alias fuck='sudo $(history -p \!\!)'
|
||||
alias cls='clear'
|
||||
17
toolbox/profile.d/99-load-user-bashrc.sh
Normal file
17
toolbox/profile.d/99-load-user-bashrc.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# If we are running in a toolbox container that uses an alt home dir, then we
|
||||
# won't be automatically loading the global user bashrc, which is annoying becasue
|
||||
# I worked hard to make that bashrc very useful to me. So the below conditional
|
||||
# checks whether the user bashrc exists (because we can't load it if it isn't there)
|
||||
# and that the current home dir does not match the user home dir (because if it does
|
||||
# then we will have already loaded the bashrc when the shell spawned and we'll get
|
||||
# stuck in a loop)
|
||||
|
||||
if [ -f /var/home/"${USER}"/.bashrc ] && [ "${HOME}" != "/var/home/${USER}" ]; then
|
||||
source /var/home/"${USER}"/.bashrc;
|
||||
fi
|
||||
|
||||
if [ -f "${HOME}"/.bashrc ]; then
|
||||
source "${HOME}/.bashrc";
|
||||
fi
|
||||
87
toolbox/profile.d/toolbox.sh
Normal file
87
toolbox/profile.d/toolbox.sh
Normal file
@@ -0,0 +1,87 @@
|
||||
# This is a patched version of the default toolbox.sh that
|
||||
# comes with default toolbox images. The only thing I modified
|
||||
# is removing the mucking about with PS1 since I'm using starship
|
||||
# for that
|
||||
|
||||
# shellcheck shell=sh
|
||||
|
||||
# shellcheck disable=SC2153
|
||||
[ "${BASH_VERSION:-}" != "" ] || [ "${ZSH_VERSION:-}" != "" ] || return 0
|
||||
[ "$PS1" != "" ] || return 0
|
||||
|
||||
toolbox_config="$HOME/.config/toolbox"
|
||||
host_welcome_stub="$toolbox_config/host-welcome-shown"
|
||||
toolbox_welcome_stub="$toolbox_config/toolbox-welcome-shown"
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck disable=SC2046
|
||||
eval $(
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
else
|
||||
. /usr/lib/os-release
|
||||
fi
|
||||
|
||||
echo ID="$ID"
|
||||
echo PRETTY_NAME="\"$PRETTY_NAME\""
|
||||
echo VARIANT_ID="$VARIANT_ID"
|
||||
)
|
||||
|
||||
if [ -f /run/ostree-booted ] \
|
||||
&& ! [ -f "$host_welcome_stub" ] \
|
||||
&& [ "${ID}" = "fedora" ] \
|
||||
&& { [ "${VARIANT_ID}" = "workstation" ] \
|
||||
|| [ "${VARIANT_ID}" = "silverblue" ] \
|
||||
|| [ "${VARIANT_ID}" = "kinoite" ] \
|
||||
|| [ "${VARIANT_ID}" = "sericea" ]; }; then
|
||||
echo ""
|
||||
echo "Welcome to ${PRETTY_NAME:-Linux}."
|
||||
echo ""
|
||||
echo "This terminal is running on the host system. You may want to try"
|
||||
echo "out the Toolbx for a directly mutable environment that allows "
|
||||
echo "package installation with DNF."
|
||||
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
|
||||
|
||||
if [ -f /run/.containerenv ] \
|
||||
&& [ -f /run/.toolboxenv ]; then
|
||||
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#?}"
|
||||
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" ] \
|
||||
&& ! [ -e "/lib/terminfo/$terminfo_sub_directory" ] \
|
||||
&& ! [ -e "$HOME/.terminfo/$terminfo_sub_directory" ] \
|
||||
&& echo "$error_message" >&2
|
||||
else
|
||||
! [ -e "$TERMINFO/$terminfo_sub_directory" ] \
|
||||
&& echo "$error_message" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
unset ID
|
||||
unset PRETTY_NAME
|
||||
unset VARIANT_ID
|
||||
unset toolbox_config
|
||||
unset host_welcome_stub
|
||||
unset toolbox_welcome_stub
|
||||
Reference in New Issue
Block a user