Add bash.d. #7

Merged
shaunrd0 merged 20 commits from bash-d into main 2026-02-21 15:14:40 +00:00
Showing only changes of commit f9163b626d - Show all commits

View File

@@ -3,26 +3,28 @@ set -Eeuo pipefail
# $1: Error message # $1: Error message
# $2: Error code # $2: Error code
# $3: Error line
function fatal() { function fatal() {
local msg=${1:-"Unspecified error"} local msg=${1:-"Unspecified error"}
echo "[Error:$LINENO] Could not install dotfiles: $msg" local line=${3:-9}
echo "[Error:$line] Could not install dotfiles: $msg"
exit ${2:-1} exit ${2:-1}
} }
trap 'fatal "Trapped an unknown error" $?' ERR trap 'fatal "Trapped an unknown error" $? $LINENO' ERR
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
fatal "Run setup.sh from the root directory of the dotfiles repository." 2 fatal "Run setup.sh from the root directory of the dotfiles repository." 2 $LINENO
fi fi
git submodule update --init --recursive git submodule update --init --recursive
# Use alias for installing packages so we don't maintain several dependency lists. # Use alias for installing packages so we don't maintain several dependency lists.
if ! [[ -f .bash.d/.bash_exports ]]; then if ! [[ -f .bash.d/.bash_exports ]]; then
fatal "Failed to locate .bash.d/.bash_exports in path: $(pwd)" 3 fatal "Failed to locate .bash.d/.bash_exports in path: $(pwd)" 3 $LINENO
fi fi
. .bash.d/.bash_exports . .bash.d/.bash_exports
if [[ -z ${DOT_PACKAGES:-} ]]; then if [[ -z ${DOT_PACKAGES:-} ]]; then
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash_aliases" 4 fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash.d/.bash_aliases" 4 $LINENO
fi fi
sudo apt update -y && sudo apt install -y $DOT_PACKAGES sudo apt update -y && sudo apt install -y $DOT_PACKAGES
go install github.com/arl/gitmux@latest go install github.com/arl/gitmux@latest