diff --git a/bin/update/README.md b/bin/update/README.md index 8a53f7b..f485de5 100644 --- a/bin/update/README.md +++ b/bin/update/README.md @@ -36,13 +36,13 @@ How over-the-air updates work on Umbrel. 11. `umbrel-dashboard` then alerts the user regarding the new update, and after the user consents, it makes a `POST` request to `umbrel-manager` to start the update process. -14. `umbrel-manager` creates a signal file on the mounted host OS volume (`$UMBREL_ROOT/signals/update`) with the version `X.Y.Z`, and returns `200 OK` to the `umbrel-dashboard`. +14. `umbrel-manager` creates a signal file on the mounted host OS volume (`$UMBREL_ROOT/events/signals/update`) with the version `X.Y.Z`, and returns `200 OK` to the `umbrel-dashboard`. -15. [`fswatch`](https://github.com/emcrisostomo/fswatch), a file monitoring tool that's continuosly monitoring the `$UMBREL_ROOT/signals/update` file notices the change, and immeditaly runs [`$UMBREL_ROOT/bin/update/start.sh`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/bin/update/start.sh) as root. +15. [`karen`] is triggered (obviously) when `$UMBREL_ROOT/events/signals/update` is touched/updated file, and immeditaly runs the update trigger [`$UMBREL_ROOT/events/triggers/update`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/events/triggers/update) as root. -16. `$UMBREL_ROOT/bin/update/start.sh` clones release `vX.Y.Z` from github in `/tmp/umbrel-vX.Y.Z`. +16. `$UMBREL_ROOT/events/triggers/update` clones release `vX.Y.Z` from github in `/tmp/umbrel-vX.Y.Z`. -17. `$UMBREL_ROOT/bin/update/start.sh` then executes all of the following update scripts from the new release `/tmp/umbrel-vX.Y.Z` one-by-one: +17. `$UMBREL_ROOT/events/triggers/update` then executes all of the following update scripts from the new release `/tmp/umbrel-vX.Y.Z` one-by-one: - [`/tmp/umbrel-vX.Y.Z/bin/update/00-run.sh`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/bin/update/00-run.sh): Pre-update preparation script (does things like make a backup) - [`/tmp/umbrel-vX.Y.Z/bin/update/01-run.sh`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/bin/update/01-run.sh): Install update script (installs the update) diff --git a/bin/update/start.sh b/events/triggers/update similarity index 88% rename from bin/update/start.sh rename to events/triggers/update index a1a811b..49bfa53 100755 --- a/bin/update/start.sh +++ b/events/triggers/update @@ -1,8 +1,9 @@ -#!/bin/bash -e +#!/usr/bin/env bash +set -euo pipefail UMBREL_ROOT=$(dirname $(readlink -f ../../$0)) # UMBREL_ROOT=/home/umbrel -RELEASE="v$(cat $UMBREL_ROOT/signals/update)" +RELEASE="v$(cat $UMBREL_ROOT/events/signals/update)" UMBREL_USER=umbrel if [ $(whoami) != 'root' ]; then @@ -17,7 +18,7 @@ echo "========== Stage: Download ============" echo "=======================================" echo -if [ -z $(grep '[^[:space:]]' $UMBREL_ROOT/signals/update) ]; then +if [ -z $(grep '[^[:space:]]' $UMBREL_ROOT/events/signals/update) ]; then echo "Empty update signal file. No release version not found." exit 1 fi @@ -61,7 +62,7 @@ echo "Deleting cloned repository" [ -d /tmp/umbrel-$RELEASE ] && rm -rf /tmp/umbrel-$RELEASE # echo "Deleting update signal file" -# rm -f $UMBREL_ROOT/signals/update +# rm -f $UMBREL_ROOT/events/signals/update echo "Removing lock" rm -f $UMBREL_ROOT/statuses/update-in-progress