#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=00-platform-guard.inc source "$SCRIPT_DIR/00-platform-guard.inc" required_packages=( cockpit cockpit-system cockpit-storaged cockpit-networkmanager cockpit-packagekit cockpit-machines cockpit-sosreport cockpit-pcp ) if ((EUID != 0)); then printf 'CRITICAL: Cockpit setup must run as root\n' >&2 exit 2 fi require_supported_ubuntu if ! command -v apt-get >/dev/null 2>&1; then printf 'CRITICAL: apt-get is required\n' >&2 exit 2 fi apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y "${required_packages[@]}" if apt-cache show cockpit-files >/dev/null 2>&1; then DEBIAN_FRONTEND=noninteractive apt-get install -y cockpit-files printf 'OK: installed optional cockpit-files package\n' else printf 'WARNING: cockpit-files is unavailable; continuing without it\n' fi systemctl enable --now cockpit.socket printf 'OK: Cockpit is enabled at https://%s:9090\n' "$(hostname)"