#!/usr/bin/env bash
#
# This script serves only to verify that the OS is a supported
# version, before we attempt to rely on that version in
# upgrade-zulip-stage-3

set -eu

ZULIP_PATH="$(readlink -f "$(dirname "$0")"/../..)"
if ! "$ZULIP_PATH/scripts/lib/supported-os"; then
    echo "Unsupported platform!"
    echo
    echo "Sorry! The support for your OS has been discontinued."
    echo "Please upgrade your OS to a supported release first,"
    echo "by following these instructions:"
    echo
    echo "https://zulip.readthedocs.io/en/latest/production/upgrade.html#upgrading-the-operating-system"
    echo
    exit 1
fi

exec "$ZULIP_PATH/scripts/lib/upgrade-zulip-stage-3" "$@"
