#!/bin/bash # BeAdmin — automated installer # https://beadmin.com # # Usage: # curl -fsSL https://setup.beadmin.com/ | bash # curl -fsSL https://setup.beadmin.com/ | bash # # Requirements: Debian 12+ / Ubuntu 22.04+, root privileges. set -euo pipefail # ── Tuning ──────────────────────────────────────────────────────────── if [ "$(id -u)" -ne 0 ]; then exit 1 fi # Refuse an unsupported OS before apt is touched. Other distros and a missing # VERSION_ID (Debian testing/sid) pass through. os_release=/etc/os-release if [ -r "$os_release" ]; then # shellcheck disable=SC1090 . "$os_release" case "${ID:-}" in ubuntu) os_min=2204 ;; debian) os_min=1200 ;; *) os_min=0 ;; esac # major*100+minor, so 21.10 (2110) is below 22.04 (2204). if [[ "${VERSION_ID:-}" =~ ^([0-9]+)(\.([0-9]+))? ]] && [ $((10#${BASH_REMATCH[1]} * 100 + 10#${BASH_REMATCH[3]:-0})) -lt "$os_min" ]; then echo "BeAdmin doesn't support ${NAME:-$ID} ${VERSION_ID}. You need Ubuntu 22.04 or later, or Debian 12 or later." >&2 exit 1 fi fi command -v wget >/dev/null 2>&1 || { apt-get update -qq && apt-get install -y -qq wget >/dev/null } wget -O /etc/apt/trusted.gpg.d/beadmin-nexus-public.gpg "https://nexus.beadmin.com/repository/public-keys/beadmin-nexus-public.gpg" chmod 644 /etc/apt/trusted.gpg.d/beadmin-nexus-public.gpg echo "deb [signed-by=/etc/apt/trusted.gpg.d/beadmin-nexus-public.gpg] https://nexus.beadmin.com/repository/beadmin/ stable main" > /etc/apt/sources.list.d/beadmin.list apt update apt install -y --no-install-recommends beadmin && systemctl enable --now beadmin