Files
dot/setup.sh

36 lines
1.1 KiB
Bash
Raw Normal View History

2026-02-14 01:58:02 +00:00
#!/usr/bin/env bash
2026-02-15 03:40:40 +00:00
set -Eeuo pipefail
# $1: Error message
# $2: Error code
2026-02-21 15:14:39 +00:00
# $3: Error line
2026-02-15 03:40:40 +00:00
function fatal() {
local msg=${1:-"Unspecified error"}
2026-02-21 15:14:39 +00:00
local line=${3:-9}
echo "[Error:$line] Could not install dotfiles: $msg"
2026-02-15 03:40:40 +00:00
exit ${2:-1}
}
2026-02-21 15:14:39 +00:00
trap 'fatal "Trapped an unknown error" $? $LINENO' ERR
2026-02-15 03:40:40 +00:00
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
2026-02-21 15:14:39 +00:00
fatal "Run setup.sh from the root directory of the dotfiles repository." 2 $LINENO
2026-02-15 03:40:40 +00:00
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-21 15:14:39 +00:00
if ! [[ -f .bash.d/.bash_exports ]]; then
fatal "Failed to locate .bash.d/.bash_exports in path: $(pwd)" 3 $LINENO
2026-02-15 03:40:40 +00:00
fi
2026-02-21 15:14:39 +00:00
. .bash.d/.bash_exports
2026-02-15 03:40:40 +00:00
if [[ -z ${DOT_PACKAGES:-} ]]; then
2026-02-21 15:14:39 +00:00
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash.d/.bash_aliases" 4 $LINENO
2026-02-15 03:40:40 +00:00
fi
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-15 03:40:40 +00: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