Update to support Raspberry Pi Bookworm and Node.js V20 (#36)
* Switch to Node.js V20 * Failsafe for updating using the wrong branch * Update to Node.js v20 and support for RPi OS Bookworm * Update to Node.js V20 * Update to Node.js V20 * Update install.sh * Update install.sh * Update install.sh * Update install.sh * Update package.json * Update package-lock.json
This commit is contained in:
parent
da281043d6
commit
cf80aa77d3
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x, 18.x]
|
||||
node-version: [20.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Open Rowing Monitor, https://github.com/laberning/openrowingmonitor
|
||||
# Open Rowing Monitor, https://github.com/JaapvanEkris/openrowingmonitor
|
||||
#
|
||||
# Update script for Open Rowing Monitor, use at your own risk!
|
||||
#
|
||||
|
|
@ -97,7 +97,7 @@ switch_branch() {
|
|||
CURRENT_DIR=$(pwd)
|
||||
SCRIPT_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd )"
|
||||
INSTALL_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
GIT_REMOTE="https://github.com/laberning/openrowingmonitor.git"
|
||||
GIT_REMOTE="https://github.com/JaapvanEkris/openrowingmonitor.git"
|
||||
|
||||
cd $INSTALL_DIR
|
||||
|
||||
|
|
@ -117,6 +117,15 @@ if getopts "b:" arg; then
|
|||
cancel "Branch \"$OPTARG\" does not exist in the repository, can not switch"
|
||||
fi
|
||||
|
||||
ARCHITECTURE=$(uname -m)
|
||||
if [[ $ARCHITECTURE == "armv6l" ]] && [[ $OPTARG != "v1beta_updates_Pi_Zero_W" ]]; then
|
||||
cancel "Branch \"$OPTARG\" doesn't work on a Pi Zero W, please use branch 'v1beta_updates_Pi_Zero_W'"
|
||||
fi
|
||||
if [[ $ARCHITECTURE != "armv6l" ]] && [[ $OPTARG == "v1beta_updates_Pi_Zero_W" ]]; then
|
||||
cancel "Branch \"$OPTARG\" is a legacy version intended for the Pi Zero W, please use branch 'v1beta_updates' or similar"
|
||||
fi
|
||||
|
||||
|
||||
if ask "Do you want to switch from branch \"$CURRENT_BRANCH\" to branch \"$OPTARG\"?" Y; then
|
||||
print "Switching to branch \"$OPTARG\"..."
|
||||
CURRENT_BRANCH=$OPTARG
|
||||
|
|
@ -124,10 +133,16 @@ if getopts "b:" arg; then
|
|||
else
|
||||
cancel "Stopping update - please run without -b parameter to do a regular update"
|
||||
fi
|
||||
|
||||
else
|
||||
print "Checking for new version..."
|
||||
REMOTE_VERSION=$(git ls-remote $GIT_REMOTE refs/heads/$CURRENT_BRANCH | awk '{print $1;}')
|
||||
|
||||
ARCHITECTURE=$(uname -m)
|
||||
if [[ $ARCHITECTURE == "armv6l" ]] && [[ $CURRENT_BRANCH != "v1beta_updates_Pi_Zero_W" ]]; then
|
||||
cancel "Branch \"$OPTARG\" doesn't work on a Pi Zero W, please use branch 'v1beta_updates_Pi_Zero_W'"
|
||||
fi
|
||||
|
||||
if [ "$LOCAL_VERSION" = "$REMOTE_VERSION" ]; then
|
||||
print "You are using the latest version of Open Rowing Monitor from branch \"$CURRENT_BRANCH\"."
|
||||
else
|
||||
|
|
|
|||
|
|
@ -51,16 +51,28 @@ ask() {
|
|||
CURRENT_DIR=$(pwd)
|
||||
INSTALL_DIR="/opt/openrowingmonitor"
|
||||
GIT_REMOTE="https://github.com/JaapvanEkris/openrowingmonitor.git"
|
||||
BRANCH="v1beta_updates"
|
||||
|
||||
print "This script will set up Open Rowing Monitor on one of the following devices"
|
||||
print " Raspberry Pi Zero W or WH"
|
||||
print " Raspberry Pi Zero 2 W or WH"
|
||||
print " Raspberry Pi 3 Model A+, B or B+"
|
||||
print " Raspberry Pi 4 Model B"
|
||||
print " Raspberry Pi 5"
|
||||
print
|
||||
print "You should only run this script on a SD Card that contains Raspberry Pi OS (Lite)"
|
||||
print "and does not contain any important data."
|
||||
|
||||
ARCHITECTURE=$(uname -m)
|
||||
if [[ $ARCHITECTURE == "armv6l" ]];
|
||||
then
|
||||
print
|
||||
print "You are running a system with ARM v6 architecture (Raspberry Pi Zero W)."
|
||||
print "Support for this hardware configuration has been discontinued due to package conflicts beyond our control."
|
||||
print "Your cheapest alternative for the current active branch is the Raspberry Pi Zero 2W"
|
||||
print "A separate legacy branch can be found at https://github.com/JaapvanEkris/openrowingmonitor/tree/v1beta__Pi_Zero_W"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "/proc/device-tree/model" ]]; then
|
||||
MODEL=$(tr -d '\0' < /proc/device-tree/model)
|
||||
else
|
||||
|
|
@ -70,19 +82,13 @@ fi
|
|||
if [[ $MODEL != Raspberry* ]]; then
|
||||
print
|
||||
cancel "This script currently only works on Raspberry Pi OS, you will have to do a manual installation."
|
||||
fi
|
||||
|
||||
VERSION=$(grep -oP '(?<=^VERSION=).+' /etc/os-release | tr -d '"')
|
||||
if [[ $VERSION == "12 (bookworm)" ]]; then
|
||||
print
|
||||
print "Error: So far this install script is not capable of installing on Raspberry Pi OS 12 (bookworm)."
|
||||
print "Please use Raspberry Pi 11 (bullseye), which can be installed via the Raspberry Manager via the 'Raspberry Pi OS (other)' option, under the Legacy versions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $VERSION != "10 (buster)" ]] && [[ $VERSION != "11 (bullseye)" ]]; then
|
||||
VERSION=$(grep -oP '(?<=^VERSION=).+' /etc/os-release | tr -d '"')
|
||||
if [[ $VERSION != "10 (buster)" ]] && [[ $VERSION != "11 (bullseye)" ]] && [[ $VERSION != "12 (bookworm)" ]]; then
|
||||
print
|
||||
print "Warning: So far this install script has only been tested with Raspberry Pi OS 10 (buster), 11 (bullseye)"
|
||||
print "Warning: So far this install script has only been tested with Raspberry Pi OS 10 (buster), 11 (bullseye) and 12 (bookworm)"
|
||||
if ! ask "You are running Raspberry Pi OS $VERSION, are you sure that you want to continue?" N; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -127,37 +133,12 @@ sudo apt-get -y install pigpio
|
|||
sudo systemctl mask pigpiod.service
|
||||
|
||||
print
|
||||
ARCHITECTURE=$(uname -m)
|
||||
if [[ $ARCHITECTURE == "armv6l" ]];
|
||||
then
|
||||
print "You are running a system with ARM v6 architecture. Official support for Node.js has been discontinued"
|
||||
print "for ARM v6."
|
||||
print "Due to package conflicts, support for this version of OpenRowingMonitor will cease in April 2025"
|
||||
print
|
||||
print "Installing experimental unofficial build of Node.js..."
|
||||
|
||||
# we stick to node 14 as there are problem with WebAssembly on node 16 on the armv6l architecture
|
||||
NODEJS_VERSION=v14.18.3
|
||||
sudo rm -rf /opt/nodejs
|
||||
sudo mkdir -p /opt/nodejs
|
||||
sudo curl https://unofficial-builds.nodejs.org/download/release/$NODEJS_VERSION/node-$NODEJS_VERSION-linux-armv6l.tar.gz | sudo tar -xz --strip 1 -C /opt/nodejs/
|
||||
|
||||
sudo ln -sfn /opt/nodejs/bin/node /usr/bin/node
|
||||
sudo ln -sfn /opt/nodejs/bin/node /usr/sbin/node
|
||||
sudo ln -sfn /opt/nodejs/bin/node /sbin/node
|
||||
sudo ln -sfn /opt/nodejs/bin/node /usr/local/bin/node
|
||||
sudo ln -sfn /opt/nodejs/bin/npm /usr/bin/npm
|
||||
sudo ln -sfn /opt/nodejs/bin/npm /usr/sbin/npm
|
||||
sudo ln -sfn /opt/nodejs/bin/npm /sbin/npm
|
||||
sudo ln -sfn /opt/nodejs/bin/npm /usr/local/bin/npm
|
||||
else
|
||||
print "Installing Node.js..."
|
||||
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
fi
|
||||
print "Installing Node.js..."
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
print
|
||||
print "Installing Open Rowing Monitor..."
|
||||
print "Installing Open Rowing Monitor, branch $BRANCH..."
|
||||
|
||||
if ! [[ -d "${INSTALL_DIR}" ]]; then
|
||||
sudo mkdir -p $INSTALL_DIR
|
||||
|
|
@ -168,24 +149,18 @@ cd $INSTALL_DIR
|
|||
# get project code from repository
|
||||
sudo git init -q
|
||||
# older versions of git would use 'master' instead of 'main' for the default branch
|
||||
sudo git checkout -q -b v1beta_updates
|
||||
sudo git checkout -q -b $BRANCH
|
||||
sudo git config remote.origin.url $GIT_REMOTE
|
||||
sudo git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
|
||||
# prevent altering line endings
|
||||
sudo git config core.autocrlf false
|
||||
sudo git fetch --force origin
|
||||
sudo git fetch --force --tags origin
|
||||
sudo git reset --hard origin/v1beta_updates
|
||||
sudo git reset --hard origin/$BRANCH
|
||||
|
||||
# add bin directory to the system path
|
||||
echo "export PATH=\"\$PATH:$INSTALL_DIR/bin\"" >> ~/.bashrc
|
||||
|
||||
# otherwise node-gyp would fail while building the system dependencies
|
||||
# On newer nodejs versions (> Node 16) we solve this via the .npmrc file
|
||||
if [[ $ARCHITECTURE == "armv6l" ]]; then
|
||||
sudo npm config set user 0
|
||||
fi
|
||||
|
||||
print
|
||||
print "Downloading and compiling Runtime dependencies..."
|
||||
sudo npm ci
|
||||
|
|
@ -223,28 +198,42 @@ fi
|
|||
if $INIT_GUI; then
|
||||
print
|
||||
print "Installing Graphical User Interface..."
|
||||
sudo apt-get -y install --no-install-recommends xserver-xorg xserver-xorg-legacy x11-xserver-utils xinit openbox chromium-browser
|
||||
sudo gpasswd -a pi tty
|
||||
sudo sed -i 's/allowed_users=console/allowed_users=anybody\nneeds_root_rights=yes/' /etc/X11/Xwrapper.config
|
||||
sudo cp install/webbrowserkiosk.service /lib/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable webbrowserkiosk
|
||||
sudo systemctl restart webbrowserkiosk
|
||||
print "sudo systemctl status webbrowserkiosk"
|
||||
sudo systemctl status webbrowserkiosk
|
||||
if [[ $VERSION == "10 (buster)" ]] || [[ $VERSION == "11 (bullseye)" ]]; then
|
||||
sudo apt-get -y install --no-install-recommends xserver-xorg xserver-xorg-legacy x11-xserver-utils xinit openbox chromium-browser
|
||||
sudo gpasswd -a pi tty
|
||||
sudo sed -i 's/allowed_users=console/allowed_users=anybody\nneeds_root_rights=yes/' /etc/X11/Xwrapper.config
|
||||
sudo cp install/webbrowserkiosk.service /lib/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable webbrowserkiosk
|
||||
sudo systemctl restart webbrowserkiosk
|
||||
print "sudo systemctl status webbrowserkiosk"
|
||||
sudo systemctl status webbrowserkiosk --no-pager
|
||||
else
|
||||
# This currently is a copy of the bullseye install, as Bookworm's Wayland install is twice as big as it still includes the X11 server
|
||||
# When we can install Wayland in a normal way, this will change as Wayland has a better kiosk mode
|
||||
sudo apt-get -y install --no-install-recommends xserver-xorg xserver-xorg-legacy x11-xserver-utils xinit openbox chromium-browser
|
||||
sudo gpasswd -a pi tty
|
||||
sudo sed -i 's/allowed_users=console/allowed_users=anybody\nneeds_root_rights=yes/' /etc/X11/Xwrapper.config
|
||||
sudo cp install/webbrowserkiosk.service /lib/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable webbrowserkiosk
|
||||
sudo systemctl restart webbrowserkiosk
|
||||
print "sudo systemctl status webbrowserkiosk"
|
||||
sudo systemctl status webbrowserkiosk --no-pager
|
||||
fi
|
||||
print
|
||||
print "Installation of Graphical User Interface finished."
|
||||
print "If the screen resolution or the screen borders are not correct, run 'sudo raspi-config' and modify the display options."
|
||||
fi
|
||||
|
||||
cd $CURRENT_DIR
|
||||
|
||||
print
|
||||
print "sudo systemctl status openrowingmonitor"
|
||||
sudo systemctl status openrowingmonitor
|
||||
sudo systemctl status openrowingmonitor --no-pager
|
||||
print
|
||||
print "Installation of Open Rowing Monitor finished."
|
||||
print "Open Rowing Monitor should now be up and running."
|
||||
print "You can now adjust the configuration in $INSTALL_DIR/config/config.js either via ssh or via the network share"
|
||||
print
|
||||
print "Please reboot the device for all features and settings to take effect."
|
||||
|
||||
cd $CURRENT_DIR
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
57
package.json
57
package.json
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
"node": ">=18"
|
||||
},
|
||||
"files": [
|
||||
"*",
|
||||
|
|
@ -30,9 +30,12 @@
|
|||
"simple-git-hooks": {
|
||||
"pre-commit": "npm run lint && npm test"
|
||||
},
|
||||
"//fix1Comment": "We install lit@2.8.0 as lit@3.0.0 breaks the webpage displaying metrics",
|
||||
"//fix2Comment": "We hold back bleno, bluetooth-hci-socket and noble, as upgrading destroys HRM compatibility",
|
||||
"dependencies": {
|
||||
"@abandonware/bleno": "^0.6.1",
|
||||
"@abandonware/noble": "^1.9.2-23",
|
||||
"@abandonware/bleno": "^0.5.1-4",
|
||||
"@abandonware/bluetooth-hci-socket": "^0.5.3-7",
|
||||
"@abandonware/noble": "^1.9.2-15",
|
||||
"chart.js": "^4.4.1",
|
||||
"chartjs-plugin-datalabels": "^2.2.0",
|
||||
"finalhandler": "^1.2.0",
|
||||
|
|
@ -46,38 +49,32 @@
|
|||
"ws": "^8.16.0",
|
||||
"xml2js": "^0.6.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@abandonware/bluetooth-hci-socket": "^0.5.3-10"
|
||||
},
|
||||
"//fix2Comment": "a hacky fix to not install the optional dependency xpc-connect which has a security issue",
|
||||
"overrides": {
|
||||
"@abandonware/bleno": {
|
||||
"xpc-connect@": "npm:debug"
|
||||
}
|
||||
},
|
||||
"//fix3Comment": "We list node-gyp@10.0.1 as an explicit dev dependency as omitting it results in node-gyp@7.1.2 being installed, which breaks the build on Node.js v20",
|
||||
"//fix4Comment": "We stick with rollup@2.79.1 and rollup-plugin-summary@1.4.3 as rollup@3.0.0 and rollup-plugin-summary@2.0.0 break the install process",
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "7.17.0",
|
||||
"@babel/plugin-proposal-decorators": "7.17.2",
|
||||
"@babel/preset-env": "7.16.11",
|
||||
"@rollup/plugin-babel": "5.3.0",
|
||||
"@rollup/plugin-commonjs": "21.0.1",
|
||||
"@rollup/plugin-node-resolve": "13.1.3",
|
||||
"@babel/eslint-parser": "^7.23.10",
|
||||
"@babel/plugin-proposal-decorators": "^7.23.9",
|
||||
"@babel/preset-env": "^7.23.9",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@snowpack/plugin-babel": "2.1.7",
|
||||
"@web/rollup-plugin-html": "1.10.1",
|
||||
"axios": "0.25.0",
|
||||
"eslint": "8.9.0",
|
||||
"eslint-config-standard": "17.0.0-0",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-lit": "1.6.1",
|
||||
"eslint-plugin-n": "14.0.0",
|
||||
"eslint-plugin-promise": "6.0.0",
|
||||
"eslint-plugin-wc": "1.3.2",
|
||||
"@web/rollup-plugin-html": "^2.1.2",
|
||||
"axios": "^1.6.7",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-lit": "^1.11.0",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-wc": "^2.0.4",
|
||||
"http2-proxy": "5.0.53",
|
||||
"markdownlint-cli2": "0.4.0",
|
||||
"markdownlint-cli2": "^0.12.1",
|
||||
"node-gyp": "^10.0.1",
|
||||
"nodemon": "^3.0.3",
|
||||
"npm-run-all": "4.1.5",
|
||||
"rollup": "2.67.2",
|
||||
"rollup-plugin-summary": "1.3.0",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-summary": "^1.4.3",
|
||||
"rollup-plugin-terser": "7.0.2",
|
||||
"simple-git-hooks": "^2.9.0",
|
||||
"snowpack": "3.8.8",
|
||||
|
|
|
|||
Loading…
Reference in New Issue