From bcf11406b611d576b1680be5b917cb32caa37c22 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Thu, 5 Feb 2026 23:42:16 +0200 Subject: [PATCH] feat(scripts): add install-apt-packages.sh for Debian/Ubuntu Install essential developer packages via apt: - Build tools: build-essential, cmake, pkg-config, autoconf, automake, libtool - Dev libraries: libssl-dev, libffi-dev, zlib1g-dev, libreadline-dev, etc. - CLI utilities: jq, tmux, tree, unzip, shellcheck, socat, gnupg Curated to avoid duplicates with cargo/go installs (ripgrep, fd, fzf, etc.). Uses batched apt install for efficiency, exits gracefully on non-Debian systems. --- scripts/install-apt-packages.sh | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 scripts/install-apt-packages.sh diff --git a/scripts/install-apt-packages.sh b/scripts/install-apt-packages.sh new file mode 100755 index 0000000..a956b24 --- /dev/null +++ b/scripts/install-apt-packages.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +set -euo pipefail +# @description Install essential apt packages for development. +# +# shellcheck source=shared.sh +source "$DOTFILES/config/shared.sh" + +msgr run "Starting to install apt packages" + +if ! command -v apt &> /dev/null; then + msgr warn "apt not found (not a Debian-based system)" + exit 0 +fi + +packages=( + # Build essentials + build-essential # gcc, g++, make + cmake # Cross-platform build system + pkg-config # Helper for compiling against libraries + autoconf # Automatic configure script builder + automake # Makefile generator + libtool # Generic library support script + + # Libraries for compiling languages + libssl-dev # SSL development headers + libffi-dev # Foreign function interface + zlib1g-dev # Compression library + libreadline-dev # Command-line editing + libbz2-dev # Bzip2 compression + libsqlite3-dev # SQLite database + libncurses-dev # Terminal UI library + + # CLI utilities (not in cargo/go/npm) + jq # JSON processor + tmux # Terminal multiplexer + tree # Directory listing + unzip # Archive extraction + shellcheck # Shell script linter + socat # Multipurpose network relay + gnupg # GPG encryption/signing + software-properties-common # add-apt-repository command +) + +install_packages() +{ + local to_install=() + + for pkg in "${packages[@]}"; do + pkg="${pkg%%#*}" + pkg="${pkg// /}" + [[ -z "$pkg" ]] && continue + + if dpkg -s "$pkg" &> /dev/null; then + msgr ok "$pkg already installed" + else + to_install+=("$pkg") + fi + done + + if [[ ${#to_install[@]} -gt 0 ]]; then + msgr run "Installing ${#to_install[@]} packages: ${to_install[*]}" + sudo apt update + sudo apt install -y "${to_install[@]}" + else + msgr ok "All packages already installed" + fi +} + +main() +{ + install_packages + msgr yay "apt package installations complete" +} + +main "$@"