Files
dot/setup.sh

34 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2026-02-14 01:58:02 +00:00
#!/usr/bin/env bash
2026-02-14 22:28:47 -05:00
set -Eeuo pipefail
# $1: Error message
# $2: Error code
function fatal() {
local msg=${1:-"Unspecified error"}
echo "[Error:$LINENO] Could not install dotfiles: $msg"
exit ${2:-1}
}
trap 'fatal "Trapped an unknown error" $?' ERR
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
fi
git submodule update --init --recursive
2026-02-14 01:58:02 +00:00
# Use alias for installing packages so we don't maintain several dependency lists.
2026-02-14 22:30:52 -05:00
if ! [[ -f .bash_aliases ]]; then
2026-02-14 22:28:47 -05:00
fatal "Failed to locate .bash_aliases in path: $(pwd)" 3
fi
2026-02-14 01:58:02 +00:00
. .bash_aliases
2026-02-14 22:28:47 -05:00
if [[ -z ${DOT_PACKAGES:-} ]]; then
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash_aliases" 4
fi
2026-02-14 22:01:54 -05:00
sudo apt update -y && sudo apt install -y $DOT_PACKAGES
2026-02-14 01:58:02 +00:00
go install github.com/arl/gitmux@latest
2026-02-14 21:48:25 -05:00
# Install bash line editor for auto completion.
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=$(pwd)/.local
rm -rf ble.sh