21 lines
631 B
PHP
21 lines
631 B
PHP
# shellcheck shell=bash
|
|
|
|
require_supported_ubuntu() {
|
|
if [[ ! -r /etc/os-release ]] || ! command -v dpkg >/dev/null 2>&1; then
|
|
printf 'CRITICAL: Ubuntu release detection requires /etc/os-release and dpkg\n' >&2
|
|
exit 2
|
|
fi
|
|
|
|
# shellcheck disable=SC1091
|
|
source /etc/os-release
|
|
if [[ "${ID:-}" != "ubuntu" ]]; then
|
|
printf 'CRITICAL: this toolkit supports Ubuntu only; detected %s\n' "${ID:-unknown}" >&2
|
|
exit 2
|
|
fi
|
|
if ! dpkg --compare-versions "${VERSION_ID:-0}" ge "24.04"; then
|
|
printf 'CRITICAL: Ubuntu 24.04 or newer is required; detected %s\n' \
|
|
"${VERSION_ID:-unknown}" >&2
|
|
exit 2
|
|
fi
|
|
}
|