#!/bin/bash # repo.sh — configure this host to consume the jamescodes apt repo. # # Usage (run as root): # curl -fsSL https://apt.jamescodes.productspeoplecareabout.com/repo.sh \ # | sudo bash -s -- # # Effects (all idempotent): # - Trusts the repo signing key at /etc/apt/keyrings/jamescodes-apt.asc # - Writes /etc/apt/sources.list.d/jamescodes.sources for the running suite # - Writes /etc/apt/auth.conf.d/jamescodes.conf with the basic-auth creds # - Runs `apt-get update` set -euo pipefail HOST="apt.jamescodes.productspeoplecareabout.com" if [[ $# -ne 2 ]]; then echo "Usage: $0 " >&2 exit 1 fi if [[ $EUID -ne 0 ]]; then echo "Run as root (sudo)." >&2 exit 1 fi USERNAME="$1" PASSWORD="$2" . /etc/os-release CODENAME="${UBUNTU_CODENAME:-${VERSION_CODENAME:-}}" if [[ -z "$CODENAME" ]]; then echo "Could not detect distro codename from /etc/os-release" >&2 exit 1 fi install -d -m 0755 /etc/apt/keyrings curl -fsSL "https://${HOST}/public.gpg.key" \ -o /etc/apt/keyrings/jamescodes-apt.asc cat > /etc/apt/sources.list.d/jamescodes.sources < /etc/apt/auth.conf.d/jamescodes.conf <