diff --git a/scripts/cloudron-setup b/scripts/cloudron-setup index e652afe84..08d07a6f0 100755 --- a/scripts/cloudron-setup +++ b/scripts/cloudron-setup @@ -8,6 +8,11 @@ function exitHandler() { trap exitHandler EXIT +vergte() { + greater_version=$(echo -e "$1\n$2" | sort -rV | head -n1) + [[ "$1" == "${greater_version}" ]] && return 0 || return 1 +} + # change this to a hash when we make a upgrade release readonly LOG_FILE="/var/log/cloudron-setup.log" readonly MINIMUM_DISK_SIZE_GB="18" # this is the size of "/" and required to fit in docker images 18 is a safe bet for different reporting on 20GB min @@ -196,6 +201,13 @@ else version="${requestedVersion}" fi +if vergte "${version}" "7.5.99"; then + if ! grep -q avx /proc/cpuinfo; then + echo "Cloudron version ${version} requires AVX support in the CPU. No avx found in /proc/cpuinfo" + exit 1 + fi +fi + if ! sourceTarballUrl=$(echo "${releaseJson}" | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["info"]["sourceTarballUrl"])'); then echo "No source code for version '${requestedVersion:-latest}'" exit 1 diff --git a/src/updater.js b/src/updater.js index e44346b95..e73dc3ad0 100644 --- a/src/updater.js +++ b/src/updater.js @@ -194,7 +194,7 @@ async function canUpdate(boxUpdateInfo) { if (!ubuntuVersion) throw new BoxError(BoxError.INTERNAL_ERROR, 'Could not determine ubuntu release'); if (ubuntuVersion.trim() === '18.04' && semver.gte(boxUpdateInfo.version, '7.5.0')) throw new BoxError(BoxError.BAD_STATE, `${boxUpdateInfo.version} requires atleast Ubuntu 20.04. Please upgrade following https://docs.cloudron.io/guides/upgrade-ubuntu-20/`); - // mongodb 6 requires AVX + // mongodb 5 requires AVX if (semver.gte(boxUpdateInfo.version, '7.6.0')) { const avxOutput = safe.child_process.execSync('grep avx /proc/cpuinfo', { encoding: 'utf8' }); if (avxOutput === null) throw new BoxError(BoxError.BAD_STATE, `${boxUpdateInfo.version} requires AVX support`);