mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-13 03:30:49 +02:00
fix (bonus.nodejs.sh): fix install to get current version of nodejs (#4767)
This commit is contained in:
parent
d620d4b895
commit
a8918dbb39
@ -6,43 +6,37 @@ VERSION="20"
|
|||||||
|
|
||||||
# command info
|
# command info
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "config script to install NodeJs $VERSION"
|
echo "config script to install Node.js $VERSION"
|
||||||
echo "bonus.nodejs.sh [on|off]"
|
echo "bonus.nodejs.sh [on|off]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# switch on
|
# switch on
|
||||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
# check if nodeJS was installed
|
# check if Node.js was installed
|
||||||
if node -v | grep "${VERSION}"; then
|
if node -v | grep "${VERSION}"; then
|
||||||
echo "nodeJS $VERSION is already installed"
|
echo "Node.js $VERSION is already installed"
|
||||||
else
|
else
|
||||||
KEYRING=/usr/share/keyrings/nodesource.gpg
|
# install prerequisites
|
||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null
|
sudo apt-get install -y curl gnupg
|
||||||
|
KEYRING=/usr/share/keyrings/nodesource-repo.gpg
|
||||||
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null
|
||||||
# wget can also be used:
|
# wget can also be used:
|
||||||
# wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null
|
# wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null
|
||||||
gpg --no-default-keyring --keyring "$KEYRING" --list-keys
|
gpg --no-default-keyring --keyring "$KEYRING" --list-keys
|
||||||
sudo chmod a+r /usr/share/keyrings/nodesource.gpg
|
sudo chmod a+r "$KEYRING"
|
||||||
|
|
||||||
# Replace with the keyring above, if different
|
echo "deb [signed-by=$KEYRING] https://deb.nodesource.com/node_$VERSION.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||||
KEYRING=/usr/share/keyrings/nodesource.gpg
|
|
||||||
# The below command will set this correctly, but if lsb_release isn't available, you can set it manually:
|
|
||||||
# - For Debian distributions: jessie, sid, etc...
|
|
||||||
# - For Ubuntu distributions: xenial, bionic, etc...
|
|
||||||
# - For Debian or Ubuntu derived distributions your best option is to use the codename corresponding to the upstream release your distribution is based off. This is an advanced scenario and unsupported if your distribution is not listed as supported per earlier in this README.
|
|
||||||
DISTRO="$(lsb_release -s -c)"
|
|
||||||
echo "deb [signed-by=$KEYRING] https://deb.nodesource.com/node_$VERSION.x $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
|
||||||
echo "deb-src [signed-by=$KEYRING] https://deb.nodesource.com/node_$VERSION.x $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
|
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y nodejs
|
sudo apt-get install -y nodejs
|
||||||
|
|
||||||
# check if nodeJS was installed
|
# check if Node.js was installed
|
||||||
if node -v; then
|
if node -v; then
|
||||||
echo "Installed nodeJS $(node -v)"
|
echo "Installed Node.js $(node -v)"
|
||||||
else
|
else
|
||||||
echo "FAIL - Was not able to install nodeJS"
|
echo "FAIL - Was not able to install Node.js"
|
||||||
echo "ABORT - nodeJs install"
|
echo "ABORT - Node.js install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user