From 191dc3aaec9b24f58c2e450486c98fc4bcaf0762 Mon Sep 17 00:00:00 2001 From: Lars Berning <151194+laberning@users.noreply.github.com> Date: Wed, 21 Apr 2021 20:25:29 +0200 Subject: [PATCH] adds an update script to make updating to new versions easier --- docs/backlog.md | 6 ++--- docs/installation.md | 8 ++++++ install/install.sh | 2 +- install/update.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100755 install/update.sh diff --git a/docs/backlog.md b/docs/backlog.md index 3332832..258533a 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -4,10 +4,11 @@ This is the very minimalistic Backlog for further development of this project. ## Soon -* add an update script to simplify the migration to new versions +* add a configuration option to change the FMTS device name +* add support for ANT+ heart rate monitors with USB dongles +* add an option to the installation script to directly attach a touchscreen to the Raspberry Pi and automatically show WebUI on this in kiosk mode * validate FTMS with more training applications and harden implementation (i.e. Holofit and Coxswain) * record a longer rowing session and analyze two encountered problems: 1) rarely the stroke rate doubles for a short duration (might be a problem with stroke detection when measurements are imprecise), 2) in one occasion the measured power jumped to a very high value after a break (40000 watts) -* add support for ANT+ heart rate monitors with USB dongles * add an option to automatically feed the measured damping constant back into the rowing engine ## Later @@ -24,4 +25,3 @@ This is the very minimalistic Backlog for further development of this project. * add video playback in background of Web UI * implement or integrate some rowing games * add possibility to define workouts (i.e. training intervals with goals) -* directly attach a touchscreen to the Raspberry Pi and automatically show WebUI on this in kiosk mode diff --git a/docs/installation.md b/docs/installation.md index 2f99345..2207f9e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -27,6 +27,14 @@ Connect to the device with SSH and initiate the following command to set up all /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/laberning/openrowingmonitor/HEAD/install/install.sh)" ``` +### Updating to a new version + +Open Rowing Monitor does not provide proper releases (yet), but you can update to the latest development version with this command: + +```zsh +sudo /opt/openrowingmonitor/install/update.sh +``` + ### If you want to run Bluetooth Low Energy and the Web-Server on port 80 without root ```zsh diff --git a/install/install.sh b/install/install.sh index f4a2d04..c13b000 100755 --- a/install/install.sh +++ b/install/install.sh @@ -74,7 +74,7 @@ sudo npm config set user 0 print print "Downloading and compiling Runtime dependencies..." -sudo npm install +sudo npm ci sudo npm run build if ! [[ -f "config/config.js" ]]; then cp install/config.js config/ diff --git a/install/update.sh b/install/update.sh new file mode 100755 index 0000000..4c66654 --- /dev/null +++ b/install/update.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# Open Rowing Monitor, https://github.com/laberning/openrowingmonitor +# +# Update script for Open Rowing Monitor, use at your own risk! +# + +# treat unset variables as an error when substituting +set -u +# exit when a command fails +set -e + +print() { + printf "%s\n" "$@" +} + +cancel() { + print "$@" + exit 1 +} + +CURRENT_DIR=$(pwd) +INSTALL_DIR="/opt/openrowingmonitor" +GIT_REMOTE="https://github.com/laberning/openrowingmonitor.git" + +print "Update script for Open Rowing Monitor" +print +print "Checking for new version..." + +cd $INSTALL_DIR + +LOCAL_VERSION=$(git rev-parse HEAD) +REMOTE_VERSION=$(git ls-remote $GIT_REMOTE HEAD | awk '{print $1;}') + +if [ "$LOCAL_VERSION" = "$REMOTE_VERSION" ]; then + print "You are using the latest version of Open Rowing Monitor." +else + print "A new version of Open Rowing Monitor is available. Do you want to update?" + print + read -p "Press RETURN to continue or CTRL + C to abort" + print "Stopping Open Rowing Monitor..." + sudo systemctl stop openrowingmonitor + + print "Fetching new version of Open Rowing Monitor..." + sudo git fetch --force origin + sudo git fetch --force --tags origin + sudo git reset --hard origin/main + + print "Updating Runtime dependencies..." + sudo npm ci + sudo npm run build + + print "Starting Open Rowing Monitor..." + sudo systemctl start openrowingmonitor + + print + print "Update complete, Open Rowing Monitor now has the following exciting new features:" + git log --reverse --pretty=format:"- %s" $LOCAL_VERSION..HEAD +fi + +cd $CURRENT_DIR