Files
pic/scripts/check_deps.sh
T
roof 30878fe539 fix: check-deps installs all required system packages via apt
scripts/check_deps.sh now checks and installs all prerequisites:
git, curl, openssl, python3, python3-cryptography, docker, docker-compose.
Runs apt-get update only once if anything needs installing.
Also adds current user to docker group if missing.
Makefile calls it with sudo so it has the rights to install packages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 09:27:45 -04:00

57 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# Install all host dependencies required by Personal Internet Cell.
# Uses apt-get (Debian/Ubuntu). Must be run with sudo or as root.
set -e
APT_UPDATED=0
apt_install() {
PKG="$1"
if ! dpkg -s "$PKG" >/dev/null 2>&1; then
echo " Installing $PKG..."
if [ "$APT_UPDATED" = "0" ]; then
apt-get update -qq
APT_UPDATED=1
fi
apt-get install -y -qq "$PKG"
else
echo " [ok] $PKG"
fi
}
echo "=== Checking system dependencies ==="
# Core tools
apt_install git
apt_install curl
apt_install openssl
apt_install python3
apt_install python3-cryptography
# Docker
if ! command -v docker >/dev/null 2>&1; then
echo " Installing docker..."
if [ "$APT_UPDATED" = "0" ]; then
apt-get update -qq
APT_UPDATED=1
fi
apt-get install -y -qq docker.io
fi
echo " [ok] docker"
# Docker Compose (v2 plugin preferred, v1 fallback)
if ! docker compose version >/dev/null 2>&1 && ! command -v docker-compose >/dev/null 2>&1; then
echo " Installing docker-compose..."
apt-get install -y -qq docker-compose
fi
echo " [ok] docker-compose"
# Ensure current user is in docker group
if ! id | grep -q '(docker)'; then
echo " Adding $(id -un) to docker group..."
usermod -aG docker "$(id -un)"
echo " NOTE: Log out and back in (or run 'newgrp docker') for docker group to take effect."
fi
echo "=== All dependencies OK ==="