mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-24 23:52:56 +00:00
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.
This commit is contained in:
75
scripts/install-apt-packages.sh
Executable file
75
scripts/install-apt-packages.sh
Executable file
@@ -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 "$@"
|
||||||
Reference in New Issue
Block a user