perf: install env checks

This commit is contained in:
2025-12-23 20:53:55 +02:00
parent a286817ce3
commit 891ae505f8
30 changed files with 492 additions and 490 deletions

3
.gitignore vendored
View File

@@ -15,6 +15,3 @@ temp
**/autoload **/autoload
**/pypoetry **/pypoetry
# darwin
.DS_Store

View File

@@ -7,3 +7,9 @@ alias reload-cache='rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/dots" ~/.zcompdump*
alias zen='curl -s https://api.github.com/zen && echo' alias zen='curl -s https://api.github.com/zen && echo'
alias la='ls -la' alias la='ls -la'
alias colby='copilot --allow-all-tools --allow-all-paths --banner' alias colby='copilot --allow-all-tools --allow-all-paths --banner'
alias gs='git s'
alias gd='git d'
alias gdc='git dc'
alias gc='git c'
alias gl='git ld'

View File

@@ -19,8 +19,6 @@
[core] [core]
autocrlf = input autocrlf = input
editor = vim
pager = less -FRX
[color] [color]
ui = auto ui = auto

View File

@@ -26,52 +26,24 @@ else
fi fi
# Log functions # Log functions
log_info() { log_info() { echo -e "${BLUE}[INFO]${NC} $*"; }
echo -e "${BLUE}[INFO]${NC} $*" log_pass() { echo -e "${GREEN}[PASS]${NC} $*"; }
} log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
log_error() { echo -e "${RED}[FAIL]${NC} $*"; }
log_debug() { echo -e "${CYAN}$*${NC}"; }
log_pass() { # Export log functions
echo -e "${GREEN}[PASS]${NC} $*" export -f log_info log_pass log_warn log_error log_debug
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $*"
}
log_error() {
echo -e "${RED}[FAIL]${NC} $*"
}
log_debug() {
echo -e "${CYAN}$*${NC}"
}
# Export log functions so they're available in sourced scripts
export -f log_info
export -f log_pass
export -f log_warn
export -f log_error
export -f log_debug
printf "\n\t${CYAN} <<< ${CYAN_BOLD}dots${CYAN} >>> ${NC}\n" printf "\n\t${CYAN} <<< ${CYAN_BOLD}dots${CYAN} >>> ${NC}\n"
printf "\t${GREY}==============${NC}\n\n" printf "\t${GREY}==============${NC}\n\n"
# High-resolution time helpers # High-resolution time helpers
# now_ns prints current time in nanoseconds using GNU date if available. if date +%s%N 2>/dev/null | grep -qE '^[0-9]+$'; then
# On systems where %N isn't supported (e.g., BSD date), it falls back to now_ns() { date +%s%N; }
# seconds precision multiplied to nanoseconds. This avoids external deps like bc.
now_ns() {
local ns
ns=$(date +%s%N 2>/dev/null || true)
if [[ "$ns" =~ ^[0-9]+$ ]]; then
echo "$ns"
else else
# Fallback: seconds precision now_ns() { echo $(( $(date +%s) * 1000000000 )); }
local s
s=$(date +%s)
echo $(( s * 1000000000 ))
fi fi
}
# Prevent running as root # Prevent running as root
if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then
@@ -85,6 +57,27 @@ if [[ -z "$SKIP_SUDO_CHECK" ]]; then
sudo -v sudo -v
fi fi
# Set up environment
export DOTS_OS=""
export DOTS_PKG=""
export DOTS_ENV=""
if [[ -n "${CODESPACES:-}" ]]; then
DOTS_ENV="codespaces"
fi
case "$OSTYPE" in
darwin*) DOTS_OS="macos"; DOTS_PKG="brew" ;;
linux*)
DOTS_OS="linux"
if command -v apt-get &>/dev/null; then
DOTS_PKG="apt"
elif command -v pacman &>/dev/null; then
DOTS_PKG="pacman"
elif command -v dnf &>/dev/null; then
DOTS_PKG="dnf"
fi
;;
esac
# Set up directory variables # Set up directory variables
if [ -L "$0" ]; then if [ -L "$0" ]; then
dir=$(dirname $(readlink -f "$0")) dir=$(dirname $(readlink -f "$0"))
@@ -128,7 +121,8 @@ run() {
echo -e "Running all install targets" echo -e "Running all install targets"
fi fi
for script in $install_dir/*.sh; do scripts=("$install_dir"/*.sh)
for script in "${scripts[@]}"; do
if [[ -n "$targets" ]]; then if [[ -n "$targets" ]]; then
script_name=$(basename "$script" .sh) script_name=$(basename "$script" .sh)
script_name=${script_name#*-} script_name=${script_name#*-}

View File

@@ -5,14 +5,16 @@
# Print operating system information and hint which installer path will run. # Print operating system information and hint which installer path will run.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then log_info "Environment: DOTS_OS=$DOTS_OS, DOTS_PKG=$DOTS_PKG, DOTS_ENV=$DOTS_ENV"
if [[ "$DOTS_OS" == "macos" ]]; then
# macOS info # macOS info
sw_vers sw_vers
log_info "Detected macOS (OSTYPE=$OSTYPE)" log_info "Detected macOS (OSTYPE=$OSTYPE)"
log_info "Package manager: Homebrew (brew)" log_info "Package manager: Homebrew (brew)"
log_info "Code path: macOS-only brew scripts will run; Linux package scripts are skipped." log_info "Code path: macOS-only brew scripts will run; Linux package scripts are skipped."
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then elif [[ "$DOTS_OS" == "linux" ]]; then
# Linux info # Linux info
if [[ -r /etc/os-release ]]; then if [[ -r /etc/os-release ]]; then
cat /etc/os-release cat /etc/os-release
@@ -21,17 +23,16 @@ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
fi fi
log_info "Detected Linux (OSTYPE=$OSTYPE, ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-n/a}, NAME=${NAME:-n/a}, VERSION_ID=${VERSION_ID:-n/a})" log_info "Detected Linux (OSTYPE=$OSTYPE, ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-n/a}, NAME=${NAME:-n/a}, VERSION_ID=${VERSION_ID:-n/a})"
log_info "Package manager detected: ${DOTS_PKG:-none}"
if command -v apt-get >/dev/null 2>&1; then if [[ -z "$DOTS_PKG" ]]; then
log_info "Package manager detected: apt-get" log_warn "No known package manager (apt-get/pacman/dnf) found on Linux."
export DOTS_PKG_MGR=apt
elif command -v pacman >/dev/null 2>&1; then
log_info "Package manager detected: pacman"
export DOTS_PKG_MGR=pacman
else
log_warn "No known package manager (apt-get/pacman) found on Linux."
fi fi
else else
log_error "Unknown OS: $OSTYPE" log_error "Unknown OS: $OSTYPE"
fi fi
if [[ "$DOTS_ENV" == "codespaces" ]]; then
log_info "Running in GitHub Codespaces"
fi

View File

@@ -5,14 +5,12 @@
# Print SSH key. # Print SSH key.
# #
# skip if CODESPACES is set # Skip in Codespaces
if [ -n "$CODESPACES" ]; then [[ "$DOTS_ENV" == "codespaces" ]] && { log_pass "Skipping in Codespaces"; return 0; }
log_warn "Running in a GitHub Codespace"
export SKIP_SSH_CONFIG=1 # Skip if explicitly disabled
fi [[ -n "$SKIP_SSH_CONFIG" ]] && { log_warn "Skipping SSH configuration"; return 0; }
# skip if SKIP_SSH_CONFIG is set
if [ -z "$SKIP_SSH_CONFIG" ]; then
ssh_method="ed25519" ssh_method="ed25519"
ssh_target="${HOME}/.ssh" ssh_target="${HOME}/.ssh"
@@ -28,6 +26,3 @@ if [ -z "$SKIP_SSH_CONFIG" ]; then
cat "$ssh_pub" cat "$ssh_pub"
unset ssh_method ssh_target ssh_key ssh_pub unset ssh_method ssh_target ssh_key ssh_pub
else
log_warn "Skipping SSH configuration"
fi

View File

@@ -5,7 +5,9 @@
# (macOS only) Install homebrew. # (macOS only) Install homebrew.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if [ -d "/opt/homebrew/bin" ]; then if [ -d "/opt/homebrew/bin" ]; then
export PATH="/opt/homebrew/bin:$PATH" export PATH="/opt/homebrew/bin:$PATH"
fi fi
@@ -23,6 +25,3 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Homebrew is already installed." echo "Homebrew is already installed."
fi fi
brew --version brew --version
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,7 +5,9 @@
# (distros with apt only) Install core apt packages. # (distros with apt only) Install core apt packages.
# #
if command -v apt-get &> /dev/null; then # apt only
[[ "$DOTS_PKG" != "apt" ]] && { log_warn "Skipping: Not using apt"; return 0; }
apt_packages=( apt_packages=(
ca-certificates ca-certificates
curl curl
@@ -20,6 +22,3 @@ if command -v apt-get &> /dev/null; then
unset apt_packages unset apt_packages
apt --version apt --version
else
log_warn "Skipping: apt-get not found"
fi

View File

@@ -5,7 +5,9 @@
# (distros with pacman only) Install core pacman packages. # (distros with pacman only) Install core pacman packages.
# #
if command -v pacman &> /dev/null; then # pacman only
[[ "$DOTS_PKG" != "pacman" ]] && { log_warn "Skipping: Not using pacman"; return 0; }
pacman_packages=( pacman_packages=(
ca-certificates ca-certificates
curl curl
@@ -20,6 +22,3 @@ if command -v pacman &> /dev/null; then
unset pacman_packages unset pacman_packages
pacman --version pacman --version
else
log_warn "Skipping: pacman not found"
fi

View File

@@ -6,17 +6,21 @@
# #
if ! command -v git &> /dev/null; then if ! command -v git &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get install -qq git sudo apt-get install -qq git
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm git sudo pacman -S --noconfirm git
else ;;
log_warn "Skipping git install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install git brew install git
fi ;;
*)
log_warn "Skipping git install: no supported package manager found"
return 0
;;
esac
fi fi
git --version git --version

View File

@@ -7,17 +7,21 @@
# install zsh # install zsh
if ! command -v zsh &> /dev/null; then if ! command -v zsh &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get install -qq zsh sudo apt-get install -qq zsh
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm zsh sudo pacman -S --noconfirm zsh
else ;;
log_warn "Skipping zsh install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install zsh brew install zsh
fi ;;
*)
log_warn "Skipping zsh install: no supported package manager found"
return 0
;;
esac
fi fi
zsh --version zsh --version

View File

@@ -6,17 +6,21 @@
# #
if ! command -v stow &> /dev/null; then if ! command -v stow &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get install -qq stow sudo apt-get install -qq stow
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm stow sudo pacman -S --noconfirm stow
else ;;
log_warn "Skipping stow install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install stow brew install stow
fi ;;
*)
log_warn "Skipping stow install: no supported package manager found"
return 0
;;
esac
fi fi
stow --version stow --version

View File

@@ -10,8 +10,8 @@ if ! echo "$PATH" | grep -q "$PYENV_ROOT"; then
export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/bin:$PATH"
fi fi
if ! command -v pyenv &>/dev/null; then if ! command -v pyenv &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment # https://github.com/pyenv/pyenv/wiki#suggested-build-environment
sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \ sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \ libbz2-dev libreadline-dev libsqlite3-dev curl \
@@ -19,7 +19,8 @@ if ! command -v pyenv &>/dev/null; then
# see https://github.com/pyenv/pyenv-installer # see https://github.com/pyenv/pyenv-installer
bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)" bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)"
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
# Prefer native packages if available; otherwise install build deps then use installer # Prefer native packages if available; otherwise install build deps then use installer
if ! sudo pacman -Qi pyenv >/dev/null 2>&1; then if ! sudo pacman -Qi pyenv >/dev/null 2>&1; then
sudo pacman -S --noconfirm --needed base-devel openssl zlib-ng-compat bzip2 readline sqlite xz tk libffi curl sudo pacman -S --noconfirm --needed base-devel openssl zlib-ng-compat bzip2 readline sqlite xz tk libffi curl
@@ -27,16 +28,18 @@ if ! command -v pyenv &>/dev/null; then
else else
sudo pacman -S --noconfirm --needed pyenv pyenv-virtualenv sudo pacman -S --noconfirm --needed pyenv pyenv-virtualenv
fi fi
else ;;
log_warn "Skipping pyenv install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install pyenv brew install pyenv
brew install pyenv-virtualenv brew install pyenv-virtualenv
fi ;;
*)
log_warn "Skipping pyenv install: no supported package manager found"
;;
esac
fi fi
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$DOTS_OS" == "linux" ]]; then
virtualenv_path="$(pyenv root)/plugins/pyenv-virtualenv" virtualenv_path="$(pyenv root)/plugins/pyenv-virtualenv"
if [ ! -d "$virtualenv_path" ]; then if [ ! -d "$virtualenv_path" ]; then
git clone \ git clone \

View File

@@ -41,17 +41,20 @@ mkdir -p ~/.local/bin
unset local_bin_path unset local_bin_path
if ! command -v pipx &>/dev/null; then if ! command -v pipx &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get install -qq pipx sudo apt-get install -qq pipx
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm python-pipx sudo pacman -S --noconfirm python-pipx
else ;;
log_warn "Skipping pipx install: no apt-get or pacman found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install pipx brew install pipx
fi ;;
*)
log_warn "Skipping pipx install: no supported package manager found"
;;
esac
fi fi
echo "pipx $(pipx --version)" echo "pipx $(pipx --version)"

View File

@@ -8,26 +8,19 @@
# skip if in WSL # skip if in WSL
if [[ -n "$WSL_DISTRO_NAME" ]]; then if [[ -n "$WSL_DISTRO_NAME" ]]; then
log_warn "Running in WSL" log_warn "Skipping: Running in WSL"
export SKIP_DOCKER_CONFIG=1 return 0
fi fi
# skip if in CODESPACES # skip if in Codespaces
if [[ -n "$CODESPACES" ]]; then [[ "$DOTS_ENV" == "codespaces" ]] && { log_pass "Skipping in Codespaces"; return 0; }
log_warn "Running in GitHub Codespaces"
export SKIP_DOCKER_CONFIG=1
fi
# skip on mac # skip on macOS
if [[ "$OSTYPE" == "darwin"* ]]; then [[ "$DOTS_OS" == "macos" ]] && { log_warn "Skipping: macOS"; return 0; }
log_warn "Running on macOS"
export SKIP_DOCKER_CONFIG=1
fi
if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if ! command -v docker &> /dev/null; then if ! command -v docker &> /dev/null; then
if command -v apt-get >/dev/null 2>&1; then case "$DOTS_PKG" in
apt)
sudo install -m 0755 -d /etc/apt/keyrings sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc
@@ -39,11 +32,14 @@ if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
sudo apt-get update sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm --needed docker docker-buildx docker-compose sudo pacman -S --noconfirm --needed docker docker-buildx docker-compose
else ;;
*)
log_warn "Skipping Docker install: no supported package manager found" log_warn "Skipping Docker install: no supported package manager found"
fi ;;
esac
fi fi
readonly docker_group="docker" readonly docker_group="docker"
@@ -56,12 +52,5 @@ if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
log_info "Adding user to docker group" log_info "Adding user to docker group"
sudo usermod -aG docker "$USER" sudo usermod -aG docker "$USER"
fi fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v docker &> /dev/null; then
brew install --cask docker
fi
fi
docker --version docker --version
else
log_warn "Skipping Docker configuration"
fi

View File

@@ -6,18 +6,21 @@
# #
if ! command -v az &>/dev/null; then if ! command -v az &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt # https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm azure-cli &>/dev/null sudo pacman -S --noconfirm azure-cli &>/dev/null
else ;;
log_warn "Skipping Azure CLI install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install azure-cli brew install azure-cli
fi ;;
*)
log_warn "Skipping Azure CLI install: no supported package manager found"
;;
esac
fi fi
az --version az --version

View File

@@ -6,22 +6,25 @@
# #
if ! command -v gh &>/dev/null; then if ! command -v gh &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt # https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null && sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null &&
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
sudo apt-get update -qq && sudo apt-get update -qq &&
sudo apt-get install -qq gh sudo apt-get install -qq gh
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm github-cli sudo pacman -S --noconfirm github-cli
else ;;
log_warn "Skipping GitHub CLI install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install gh brew install gh
fi ;;
*)
log_warn "Skipping GitHub CLI install: no supported package manager found"
;;
esac
fi fi
gh --version gh --version

View File

@@ -6,8 +6,8 @@
# #
if ! command -v terraform &>/dev/null; then if ! command -v terraform &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg" terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
if [[ ! -f "$terraform_keyring_path" ]]; then if [[ ! -f "$terraform_keyring_path" ]]; then
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$terraform_keyring_path" curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$terraform_keyring_path"
@@ -17,15 +17,18 @@ if ! command -v terraform &>/dev/null; then
sudo tee /etc/apt/sources.list.d/hashicorp.list sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update -qq && sudo apt-get update -qq &&
sudo apt-get install -qq terraform sudo apt-get install -qq terraform
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm terraform sudo pacman -S --noconfirm terraform
else ;;
log_warn "Skipping Terraform install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew tap hashicorp/tap brew tap hashicorp/tap
brew install hashicorp/tap/terraform brew install hashicorp/tap/terraform
fi ;;
*)
log_warn "Skipping Terraform install: no supported package manager found"
;;
esac
fi fi
terraform --version terraform --version

View File

@@ -5,11 +5,10 @@
# (macOS only) Install iTerm2. # (macOS only) Install iTerm2.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if ! brew list --cask iterm2 &>/dev/null; then if ! brew list --cask iterm2 &>/dev/null; then
brew install --cask iterm2 brew install --cask iterm2
fi fi
log_pass "iTerm2 installed successfully!" log_pass "iTerm2 installed successfully!"
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,7 +5,9 @@
# (macOS only) Install nerdfonts. # (macOS only) Install nerdfonts.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
fonts_list=( fonts_list=(
font-fira-mono-nerd-font font-fira-mono-nerd-font
font-fira-code-nerd-font font-fira-code-nerd-font
@@ -19,6 +21,3 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi fi
unset fonts_list unset fonts_list
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -6,8 +6,8 @@
# #
if ! command -v redis-cli &>/dev/null; then if ! command -v redis-cli &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
redis_keyring_path="/usr/share/keyrings/redis-archive-keyring.gpg" redis_keyring_path="/usr/share/keyrings/redis-archive-keyring.gpg"
if [[ ! -f "$redis_keyring_path" ]]; then if [[ ! -f "$redis_keyring_path" ]]; then
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o "$redis_keyring_path" curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o "$redis_keyring_path"
@@ -15,14 +15,17 @@ if ! command -v redis-cli &>/dev/null; then
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" \ echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/redis.list > /dev/null | sudo tee /etc/apt/sources.list.d/redis.list > /dev/null
sudo apt-get install -qq redis sudo apt-get install -qq redis
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm redis sudo pacman -S --noconfirm redis
else ;;
log_warn "Skipping Redis install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install redis brew install redis
fi ;;
*)
log_warn "Skipping Redis install: no supported package manager found"
;;
esac
fi fi
redis-cli --version redis-cli --version

View File

@@ -5,12 +5,11 @@
# (macOS only) Install Colour Contrast Analyser (CCA). # (macOS only) Install Colour Contrast Analyser (CCA).
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if ! brew list --cask colour-contrast-analyser &> /dev/null; then if ! brew list --cask colour-contrast-analyser &> /dev/null; then
brew install --cask colour-contrast-analyser brew install --cask colour-contrast-analyser
else else
echo "Colour Contrast Analyser (CCA) is already installed." echo "Colour Contrast Analyser (CCA) is already installed."
fi fi
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,12 +5,11 @@
# (macOS only) Install Rectangle. # (macOS only) Install Rectangle.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if ! brew list --cask rectangle &> /dev/null; then if ! brew list --cask rectangle &> /dev/null; then
brew install --cask rectangle brew install --cask rectangle
else else
echo "Rectangle is already installed." echo "Rectangle is already installed."
fi fi
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,12 +5,11 @@
# (macOS only) Install MeetingBar. # (macOS only) Install MeetingBar.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if ! brew list --cask meetingbar &> /dev/null; then if ! brew list --cask meetingbar &> /dev/null; then
brew install --cask meetingbar brew install --cask meetingbar
else else
echo "MeetingBar is already installed." echo "MeetingBar is already installed."
fi fi
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,12 +5,11 @@
# (macOS only) Install BetterDisplay. # (macOS only) Install BetterDisplay.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if ! brew list --cask betterdisplay &> /dev/null; then if ! brew list --cask betterdisplay &> /dev/null; then
brew install --cask betterdisplay brew install --cask betterdisplay
else else
echo "BetterDisplay is already installed." echo "BetterDisplay is already installed."
fi fi
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,12 +5,11 @@
# (macOS only) Install dockutil. # (macOS only) Install dockutil.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
if ! brew list dockutil &> /dev/null; then if ! brew list dockutil &> /dev/null; then
brew install dockutil brew install dockutil
else else
echo "dockutil is already installed." echo "dockutil is already installed."
fi fi
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -6,17 +6,20 @@
# #
if ! command -v neofetch &>/dev/null; then if ! command -v neofetch &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get install -qq neofetch &>/dev/null sudo apt-get install -qq neofetch &>/dev/null
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
yay -S --noconfirm neofetch &>/dev/null yay -S --noconfirm neofetch &>/dev/null
else ;;
log_warn "Skipping neofetch install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install neofetch brew install neofetch
fi ;;
*)
log_warn "Skipping neofetch install: no supported package manager found"
;;
esac
fi fi
echo "$(neofetch --version)" echo "$(neofetch --version)"

View File

@@ -5,27 +5,23 @@
# Install cmatrix. # Install cmatrix.
# #
# skip if in CODESPACES # skip if in Codespaces
if [[ -n "$CODESPACES" ]]; then [[ "$DOTS_ENV" == "codespaces" ]] && { log_pass "Skipping in Codespaces"; return 0; }
log_warn "Running in GitHub Codespaces"
export SKIP_CMATRIX_CONFIG=1
fi
if [[ -z "$SKIP_CMATRIX_CONFIG" ]]; then
if ! command -v cmatrix &> /dev/null; then if ! command -v cmatrix &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then case "$DOTS_PKG" in
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get install -qq cmatrix &>/dev/null sudo apt-get install -qq cmatrix &>/dev/null
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
sudo pacman -S --noconfirm cmatrix &>/dev/null sudo pacman -S --noconfirm cmatrix &>/dev/null
else ;;
log_warn "Skipping cmatrix install: no supported package manager found" brew)
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install cmatrix brew install cmatrix
fi ;;
*)
log_warn "Skipping cmatrix install: no supported package manager found"
;;
esac
fi fi
log_pass "cmatrix installed successfully!" log_pass "cmatrix installed successfully!"
else
log_warn "Skipping cmatrix configuration"
fi

View File

@@ -5,7 +5,9 @@
# (macOS only) Configure defaults # (macOS only) Configure defaults
# #
if [[ "$OSTYPE" == "darwin"* ]]; then # macOS only
[[ "$DOTS_OS" != "macos" ]] && { log_warn "Skipping: Not macOS"; return 0; }
# Keyboard # Keyboard
# -------- # --------
# off -- Keyboard: Capitalize words automatically # off -- Keyboard: Capitalize words automatically
@@ -184,6 +186,3 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi fi
killall Dock 2>/dev/null || true killall Dock 2>/dev/null || true
else
log_warn "Skipping: Not macOS"
fi

View File

@@ -5,22 +5,26 @@
# Clean up after installation. # Clean up after installation.
# #
if [[ "$OSTYPE" == "darwin"* ]]; then case "$DOTS_PKG" in
brew)
brew cleanup brew cleanup
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then ;;
if command -v apt-get >/dev/null 2>&1; then apt)
sudo apt-get autoremove -qq sudo apt-get autoremove -qq
sudo apt-get clean -qq sudo apt-get clean -qq
elif command -v pacman >/dev/null 2>&1; then ;;
pacman)
# Remove orphans if any (ignore error if none) # Remove orphans if any (ignore error if none)
if pacman -Qtdq >/dev/null 2>&1; then if pacman -Qtdq >/dev/null 2>&1; then
sudo pacman -Rns --noconfirm $(pacman -Qtdq) || true sudo pacman -Rns --noconfirm $(pacman -Qtdq) || true
fi fi
# Clear package cache without interactive prompt # Clear package cache without interactive prompt
yes | sudo pacman -Scc >/dev/null 2>&1 || true yes | sudo pacman -Scc >/dev/null 2>&1 || true
else ;;
*)
log_warn "Skipping cleanup: no supported package manager found" log_warn "Skipping cleanup: no supported package manager found"
fi return 0
fi ;;
esac
log_pass "Cleanup completed successfully!" log_pass "Cleanup completed successfully!"