librelad 4f5a803ee4 feat(checks): accept Ubuntu 26.04 as a tested version
Ubuntu 26.04 hit the "untested and may not be fully supported" prompt
and blocked non-interactive installs. Add it to the supported list.

Also escape the dots in the version alternation — unescaped they matched
any character, so e.g. "18X04" was treated as a tested release.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 10:49:14 +01:00

52 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
detectOS() {
if [ -f /etc/os-release ]; then
source /etc/os-release
OS_TYPE=""
OS_VERSION="$VERSION_ID"
# Check main ID and ID_LIKE to catch derivatives like Pop!_OS
case "$ID" in
debian)
OS_TYPE="Debian"
;;
ubuntu | pop)
OS_TYPE="Ubuntu"
;;
arch)
OS_TYPE="Arch"
;;
*)
if [[ "$ID_LIKE" =~ "debian" ]]; then
OS_TYPE="Debian"
elif [[ "$ID_LIKE" =~ "ubuntu" ]]; then
OS_TYPE="Ubuntu"
else
isError "Unsupported OS detected."
exit 1
fi
;;
esac
isNotice "Detected OS: $OS_TYPE $OS_VERSION"
# Check if this is a tested/supported version
if [[ ("$OS_TYPE" == "Debian" && ! "$OS_VERSION" =~ ^(10|11|12|13)$) ||
("$OS_TYPE" == "Ubuntu" && ! "$OS_VERSION" =~ ^(18\.04|20\.04|22\.04|26\.04)$) ]]; then
isNotice "This OS version ($OS_VERSION) is untested and may not be fully supported."
while true; do
read -rp "Do you wish to continue anyway? (y/n): " oswarningaccept
case "$oswarningaccept" in
[Yy]) break ;;
[Nn]) exit 1 ;;
*) isNotice "Invalid input. Please enter y or n." ;;
esac
done
fi
else
isError "Unable to detect OS."
exit 1
fi
}