fix: replace deprecated nodesource repository installation

This commit is contained in:
Roni Väyrynen
2023-11-01 13:57:56 +02:00
parent e60e601d20
commit e35c9d0fef

View File

@@ -218,6 +218,9 @@ function InstallDependenciesRPM {
# only install nodejs repo if user allows it to be installed
if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
# enable these once https://github.com/ronivay/XenOrchestraInstallerUpdater/issues/200 is resolved
#runcmd "yum install https://rpm.nodesource.com/pub_${NODEVERSION}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y"
#runcmd "yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1"
fi
runcmd "yum install -y nodejs"
@@ -322,7 +325,10 @@ function InstallDependenciesDeb {
# only install nodejs repo if user allows it to be installed
if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -"
runcmd "mkdir -p /usr/share/keyrings"
runcmd "curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --yes --dearmor -o /usr/share/keyrings/nodesource.gpg"
runcmd "echo \"deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEVERSION}.x nodistro main\" > /etc/apt/sources.list.d/nodesource.list"
runcmd "apt-get update"
fi
runcmd "apt-get install -y nodejs"
@@ -371,6 +377,21 @@ function UpdateNodeYarn {
return 0
fi
if [[ "$INSTALL_REPOS" == "true" ]]; then
printinfo "Installing nodesource repository"
# enable these once https://github.com/ronivay/XenOrchestraInstallerUpdater/issues/200 is resolved
#if [ "$PKG_FORMAT" == "rpm" ]; then
# runcmd "yum install https://rpm.nodesource.com/pub_${NODEVERSION}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y"
# runcmd "yum clean all"
#fi
if [ "$PKG_FORMAT" == "deb" ]; then
runcmd "mkdir -p /usr/share/keyrings"
runcmd "curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --yes --dearmor -o /usr/share/keyrings/nodesource.gpg"
runcmd "echo \"deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEVERSION}.x nodistro main\" > /etc/apt/sources.list.d/nodesource.list"
runcmd "apt-get update"
fi
fi
echo
printinfo "Checking current node.js version"
local NODEV=$(runcmd_stdout "node -v 2>/dev/null| grep -Eo '[0-9.]+' | cut -d'.' -f1")
@@ -382,9 +403,10 @@ function UpdateNodeYarn {
echo
printprog "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
# remove following two lines once https://github.com/ronivay/XenOrchestraInstallerUpdater/issues/200 is resolved
runcmd "curl -sL https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
runcmd "yum clean all"
runcmd "yum install -y nodejs"
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
else
@@ -405,8 +427,6 @@ function UpdateNodeYarn {
echo
printprog "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
runcmd "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -"
runcmd "apt-get install -y nodejs"
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
else