Files
linux-provisioning/stages/00-envcheck.sh
Julian Prester 180c5838ea Initial commit: linux-provision repo
Distribution-agnostic provisioning script that sets up a new Linux machine
(Detected via lib/distro.sh - supports Debian/Ubuntu/Pop and Fedora families).

13 stages covering:
- System packages, external repos, toolchains (nvm, uv, Python)
- Shell config (zsh, oh-my-zsh, p10k), git, SSH
- Custom uv tools from ~40 git repos
- Desktop config (keybindings, hotkeys, ghostty, fonts)
- Docker, system tweaks, browser/app installs
- Custom systemd user services (porridge, swayidle, mempi-sync, etc.)
- API keys loaded from Bitwarden at shell startup
2026-06-05 21:22:44 +10:00

43 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# ===========================================================================
# Stage 00: Environment Checks
# Verifies we can proceed: distro detected, sudo available, dirs exist.
# Distro detection is handled by lib/distro.sh (sourced by provision.sh).
# ===========================================================================
info "Distribution: ${DISTRO_ID} ${DISTRO_VERSION} (${DISTRO_FAMILY} family)"
info "Package manager: ${PKG_MGR}"
# ---- Sudo access ----
info "Checking sudo access..."
if ! sudo -n true 2>/dev/null; then
info "Sudo access required. You may be prompted for your password."
sudo -v || { error "Sudo required for provisioning."; exit 1; }
fi
ok "Sudo access confirmed."
# Keep sudo timestamp fresh
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# ---- Directory structure ----
info "Setting up directory structure..."
mkdir -p "$HOME/Development"
mkdir -p "$HOME/.local/bin"
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.local/share"
ok "Directory structure ready."
# ---- Internet check ----
info "Checking internet connectivity..."
if ! ping -c 1 -W 3 google.com &>/dev/null && ! ping -c 1 -W 3 github.com &>/dev/null; then
warn "No internet detected. Some steps may fail."
else
ok "Internet connectivity confirmed."
fi
# ---- Package cache update (first time) ----
info "Updating package cache (first run)..."
$PKG_UPDATE 2>/dev/null || warn "Package cache update had issues."
ok "Stage 00 complete."