1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-24 07:37:04 +00:00

Try namespacing the variables pulled in from /etc/os-release

Kind of like https://unix.stackexchange.com/a/477443.
This commit is contained in:
Joshua Tauberer 2024-12-22 07:37:27 -05:00
parent 357fed3070
commit 3decfcdbd8

View File

@ -8,13 +8,14 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi
. /etc/os-release
# Check that we are running on Ubuntu 22.04 LTS (or 22.04.xx).
if [ "${ID:-}" != "ubuntu" ] || [ "${VERSION_ID:-}" != "22.04" ]; then
# Pull in the variables defined in /etc/os-release but in a
# namespace to avoid polluting our variables.
source <(cat /etc/os-release | sed s/^/OS_RELEASE_/)
if [ "${OS_RELEASE_ID:-}" != "ubuntu" ] || [ "${OS_RELEASE_VERSION_ID:-}" != "22.04" ]; then
echo "Mail-in-a-Box only supports being installed on Ubuntu 22.04, sorry. You are running:"
echo
echo "${ID:-"Unknown linux distribution"} ${VERSION_ID:-}"
echo "${OS_RELEASE_ID:-"Unknown linux distribution"} ${OS_RELEASE_VERSION_ID:-}"
echo
echo "We can't write scripts that run on every possible setup, sorry."
exit 1