Installing global npm packages in one command.

This commit is contained in:
Roland 2022-12-28 20:05:39 -07:00
parent a9560992c5
commit 7b71554ad7
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
3 changed files with 13 additions and 20 deletions

View file

@ -1,10 +1,10 @@
#! /usr/bin/env bash
# This script will install WROLPi to `/opt/wrolpi` on a fresh/empty Raspberry Pi. It is expected to be run once to
# This script will install WROLPi to `/opt/wrolpi` on a fresh/empty machine. It is expected to be run once to
# install, and any subsequent runs will update WROLPi. This script assumes it will be run as the `root` user.
Help() {
# Display Help
echo "Install WROLPi onto this Raspberry Pi."
echo "Install WROLPi onto this machine."
echo
echo "Syntax: install.sh [-h] [-b BRANCH]"
echo "options:"

View file

@ -10,27 +10,25 @@ apt install -y apt-transport-https ca-certificates curl gnupg-agent gcc libpq-de
postgresql-13 nginx-full nginx-doc python3-full python3-dev python3-doc python3-venv htop vim ffmpeg hostapd \
chromium chromium-driver cpufrequtils network-manager npm
# Install Archiving tools.
SF_VERSION="1.0.15"
if [ "$(single-file --version)" != "${SF_VERSION}" ]; then
sudo npm i -g single-file-cli@1.0.15 & # Install in background.
fi
readability-extractor --version || npm install -g 'git+https://github.com/pirate/readability-extractor'
# Install serve, and archiving tools.
sudo npm i -g serve single-file-cli@1.0.15 'git+https://github.com/pirate/readability-extractor' &
# Setup the virtual environment that main.py expects
pip3 --version || (
# If no pip, install pip
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py &&
python3 /tmp/get-pip.py
python3 /tmp/get-pip.py &
)
# Wait for npm and pip3.
wait $(jobs -p)
# Build React app in background job.
[[ ! -f /usr/local/bin/serve || ! -f /usr/bin/serve ]] && npm -g install serve
cd /opt/wrolpi/app || exit 5
npm install || npm install || npm install || npm install # try install multiple times :(
npm run build &
# Install python requirements files in background job.
# Install python requirements in background job.
pip3 install -r /opt/wrolpi/requirements.txt &
wait $(jobs -p)

View file

@ -13,12 +13,8 @@ apt install -y apt-transport-https ca-certificates curl gnupg-agent gcc libpq-de
postgresql-12 nginx-full nginx-doc python3.8-minimal python3.8-dev python3.8-doc python3.8-venv \
ffmpeg hostapd nodejs chromium-browser chromium-chromedriver cpufrequtils network-manager
# Install Archiving tools.
SF_VERSION="1.0.15"
if [ "$(single-file --version)" != "${SF_VERSION}" ]; then
sudo npm i -g single-file-cli@${SF_VERSION} & # Install in background.
fi
readability-extractor --version || npm install -g 'git+https://github.com/pirate/readability-extractor' &
# Install serve, and archiving tools.
sudo npm i -g serve single-file-cli@1.0.15 'git+https://github.com/pirate/readability-extractor' &
# Setup the virtual environment that main.py expects
pip3 --version || (
@ -27,16 +23,15 @@ pip3 --version || (
python3 /tmp/get-pip.py &
)
# Wait for single-file, readability, pip3.
# Wait for npm and pip3.
wait $(jobs -p)
# Build React app in background job.
[[ ! -f /usr/local/bin/serve || ! -f /usr/bin/serve ]] && npm -g install serve
cd /opt/wrolpi/app || exit 5
npm install || npm install || npm install || npm install # try install multiple times :(
npm run build &
# Install python requirements files in background job.
# Install python requirements in background job.
pip3 install -r /opt/wrolpi/requirements.txt &
wait $(jobs -p)