Browse Source

Change signal file path

ota-updates
Mayank 5 years ago
parent
commit
db901b4ebe
No known key found for this signature in database GPG Key ID: D037D60476CE748C
  1. 12
      bin/update/README.md
  2. 6
      bin/update/start.sh

12
bin/update/README.md

@ -26,7 +26,7 @@ How over-the-air updates work on Umbrel.
6. When the user opens his [`umbrel-dashboard`](https://github.com/getumbrel/umbrel-dashboard), it periodically polls [`umbrel-manager`](https://github.com/getumbrel/umbrel-manager) to check for new updates.
7. `umbrel-manager` fetches the latest `info.json` from umbrel's main repo's master branch using `GET https://raw.githubusercontent.com/getumbrel/umbrel/master/info.json`, compares it's `version` with the `version` of the local `$HOME/info.json` file, and exits if both the versions are same.
7. `umbrel-manager` fetches the latest `info.json` from umbrel's main repo's master branch using `GET https://raw.githubusercontent.com/getumbrel/umbrel/master/info.json`, compares it's `version` with the `version` of the local `$UMBREL_ROOT/info.json` file, and exits if both the versions are same.
8. If fetched `version` > local `version`, `umbrel-manager` checks if local `version` >= `requires` in the fetched `info.json`.
@ -36,17 +36,17 @@ 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 (`$HOME/statuses/start-updated`) 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/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 `$HOME/statuses/start-update` file notices the change, and immeditaly runs [`$HOME/bin/update/start.sh`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/bin/update/start.sh) as root.
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.
16. `$HOME/bin/update/start.sh` clones release `vX.Y.Z` from github in `/tmp/umbrel-vX.Y.Z`.
16. `$UMBREL_ROOT/bin/update/start.sh` clones release `vX.Y.Z` from github in `/tmp/umbrel-vX.Y.Z`.
17. `$HOME/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/bin/update/start.sh` 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)
- [`/tmp/umbrel-vX.Y.Z/bin/update/02-run.sh`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/bin/update/02-run.sh): Post-update script (used to run unit-tests to make sure the update was successfully installed)
- [`/tmp/umbrel-vX.Y.Z/bin/update/03-run.sh`](https://github.com/mayankchhabra/umbrel/blob/ota-updates/bin/update/03-run.sh): Success script (runs after the updated has been successfully downloaded and installeed)
All of the above scripts continuosly update `$HOME/bin/update/status.json` with the progress of upgrade, which the dashboard periodically fetches every 2s via `umbrel-manager` to notify the user on the progress of update.
All of the above scripts continuosly update `$UMBREL_ROOT/bin/update/status.json` with the progress of upgrade, which the dashboard periodically fetches every 2s via `umbrel-manager` to notify the user on the progress of update.

6
bin/update/start.sh

@ -2,12 +2,12 @@
# UMBREL_PATH=$(dirname $(readlink -f $0))
UMBREL_PATH=/home/umbrel
RELEASE="v$(cat $UMBREL_PATH/statuses/start-update)"
RELEASE="v$(cat $UMBREL_PATH/signals/update)"
UMBREL_USER=umbrel
echo "==== OTA UPDATE ===== | STAGE: DOWNLOAD"
if [ -z $(grep '[^[:space:]]' $UMBREL_PATH/statuses/start-update) ] ;then
if [ -z $(grep '[^[:space:]]' $UMBREL_PATH/signals/update) ] ;then
echo "Empty start update signal file. Version not found"
exit 1
fi
@ -49,7 +49,7 @@ echo "Deleting cloned repository"
[ -d /tmp/umbrel-$RELEASE ] && rm -rf /tmp/umbrel-$RELEASE
echo "Deleting update signal file"
rm -f $UMBREL_PATH/statuses/start-update
rm -f $UMBREL_PATH/signals/update
echo "Removing lock"
rm -f $UMBREL_PATH/statuses/update-in-progress

Loading…
Cancel
Save