2022-07-23 13:16:10 +02:00
|
|
|
#!/usr/bin/env bash
|
2022-02-17 13:54:42 +01:00
|
|
|
|
2022-12-12 20:38:44 +01:00
|
|
|
# This installs NodeJS, NPM and TestCafe on Linux.
|
2022-07-23 13:55:05 +02:00
|
|
|
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-nodejs.sh)
|
|
|
|
|
2022-07-23 13:08:24 +02:00
|
|
|
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
2022-03-23 08:16:01 +01:00
|
|
|
|
2022-12-12 20:38:44 +01:00
|
|
|
# Abort if not executed as root.
|
2022-02-17 13:54:42 +01:00
|
|
|
if [[ $(id -u) != "0" ]]; then
|
2022-02-25 16:33:46 +01:00
|
|
|
echo "Usage: run ${0##*/} as root" 1>&2
|
2022-02-17 13:54:42 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-02-19 15:32:52 +01:00
|
|
|
set -e
|
|
|
|
|
2023-03-27 09:30:17 +02:00
|
|
|
. /etc/os-release
|
2022-02-19 15:32:52 +01:00
|
|
|
|
2023-03-27 09:30:17 +02:00
|
|
|
if [[ $VERSION_CODENAME == "lunar" ]]; then
|
|
|
|
echo "Installing NodeJS and NPM distribution packages..."
|
|
|
|
apt-get update && apt-get -qq install nodejs npm
|
|
|
|
else
|
|
|
|
SETUP_URL="https://deb.nodesource.com/setup_18.x"
|
2022-08-10 09:26:30 +02:00
|
|
|
|
2023-03-27 09:30:17 +02:00
|
|
|
echo "Fetching packages from \"$SETUP_URL\"..."
|
|
|
|
wget --inet4-only -c -qO- $SETUP_URL | bash -
|
|
|
|
|
|
|
|
echo "Installing NodeJS, NPM, and TestCafe..."
|
|
|
|
apt-get update && apt-get -qq install nodejs
|
|
|
|
fi
|
2022-08-10 09:26:30 +02:00
|
|
|
|
2022-02-23 12:10:34 +01:00
|
|
|
npm install --unsafe-perm=true --allow-root -g npm testcafe
|
2022-02-17 13:54:42 +01:00
|
|
|
npm config set cache ~/.cache/npm
|
2022-07-19 17:18:05 +02:00
|
|
|
npm update --unsafe-perm=true --allow-root -g
|
2022-02-19 15:32:52 +01:00
|
|
|
|
|
|
|
echo "Done."
|