#!/usr/bin/env bash
#Copyright (C) 2023 The Qt Company Ltd
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

set -ex

# shellcheck source=../common/unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh"

# shellcheck source=./DownloadURL.sh
source "${BASH_SOURCE%/*}/../common/unix/DownloadURL.sh"

installerFile="install_nvm.sh"
sha="4a2e53d74d1efc48cad782e5f1316e6162a4d2b3"
cacheUrl="https://ci-files01-hki.ci.qt.io/input/nodejs/${installerFile}"
target="${installerFile}"
if DownloadURL "$cacheUrl" "" "$sha" "$target"; then
    chmod +x "$target"
    "./$target"
    rm -f "$target"
fi

\. "$HOME/.nvm/nvm.sh"
nvm install 22
