Files
linux-provisioning/stages/02-packages.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

126 lines
4.0 KiB
Bash

#!/usr/bin/env bash
# ===========================================================================
# Stage 02: System Packages
# Installs all non-default packages — distro-agnostic.
#
# Package names that differ between Debian and Fedora are handled via
# pkg_install_mapped() or conditional branches.
# Same-name packages are installed with pkg_install().
# ===========================================================================
info "Installing system packages (this may take a while)..."
# ===========================================================================
# A. Development tools & compilers
# ===========================================================================
echo " Development tools..."
pkg_group_install "Development Tools" # Fedora only
# Common dev packages (same name on both)
pkg_install cmake
# Differently-named dev packages
pkg_install_mapped "build-essential" "@development-tools"
pkg_install_mapped "g++" "gcc-c++"
# Kernel headers
if [ "$DISTRO_FAMILY" = "debian" ]; then
pkg_install "linux-headers-$(uname -r)" 2>/dev/null || pkg_install linux-headers-generic
else
pkg_install kernel-devel kernel-headers
fi
pkg_install dkms
# ===========================================================================
# B. CLI utilities
# ===========================================================================
echo " CLI utility packages..."
# Same-name CLI tools
pkg_install \
ripgrep \
fd-find \
jq \
just \
ffmpeg \
wl-clipboard \
wtype \
wofi
# fd-find may need a symlink (binary is fdfind on both distros)
if command -v fdfind &>/dev/null && ! command -v fd &>/dev/null; then
if [ "$DISTRO_FAMILY" = "debian" ]; then
sudo ln -sf "$(which fdfind)" /usr/local/bin/fd 2>/dev/null || true
else
sudo ln -sf "$(which fdfind)" /usr/local/bin/fd 2>/dev/null || true
fi
fi
# Differently-named
pkg_install_mapped "imagemagick" "ImageMagick"
# ===========================================================================
# C. Media & graphics
# ===========================================================================
echo " Media & graphics packages..."
pkg_install gimp vlc
# ===========================================================================
# D. Fonts
# ===========================================================================
echo " Font packages..."
if [ "$DISTRO_FAMILY" = "debian" ]; then
pkg_install fonts-powerline fonts-noto-cjk fonts-noto-cjk-extra \
fonts-noto-core fonts-noto-ui-core 2>/dev/null || true
else
pkg_install powerline-fonts google-noto-cjk-fonts \
google-noto-fonts-common 2>/dev/null || true
fi
# ===========================================================================
# E. System tools
# ===========================================================================
echo " System tool packages..."
pkg_install \
powertop \
smartmontools \
solaar 2>/dev/null || warn " Some system tools failed."
# TLP — laptop power management
if [ "$DISTRO_FAMILY" = "debian" ]; then
pkg_install tlp 2>/dev/null || warn " tlp not available."
else
pkg_install tlp tlp-rdw 2>/dev/null || warn " tlp not available."
fi
# ===========================================================================
# F. General utilities
# ===========================================================================
echo " General utility packages..."
pkg_install \
rsync \
curl \
wget \
unzip \
p7zip 2>/dev/null || true
# ---- Ghostty terminal emulator ----
# Fedora: in official repos since F40
# Ubuntu/Pop: via PPA (added in stage 01)
echo " Ghostty terminal emulator..."
pkg_install ghostty 2>/dev/null || warn " ghostty install failed."
# ---- VS Code ----
echo " VS Code..."
pkg_install code 2>/dev/null || warn " code install failed."
# ===========================================================================
# Start enabled services
# ===========================================================================
if command -v tlp &>/dev/null; then
$SERVICE_ENABLE tlp 2>/dev/null || true
fi
ok "Stage 02 complete: system packages installed."