From 0277601d175e1c49323b7d36e277fa93d20f192b Mon Sep 17 00:00:00 2001 From: Mayank Chhabra Date: Thu, 30 Jul 2020 12:00:50 +0530 Subject: [PATCH] Move OTA update logic to scripts/update (#66) --- bin/.gitkeep | 0 events/triggers/update | 2 +- {bin => scripts}/update/.updateignore | 0 {bin => scripts}/update/00-run.sh | 2 +- {bin => scripts}/update/01-run.sh | 2 +- {bin => scripts}/update/02-run.sh | 0 {bin => scripts}/update/03-run.sh | 0 {bin => scripts}/update/README.md | 8 ++++---- 8 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 bin/.gitkeep rename {bin => scripts}/update/.updateignore (100%) rename {bin => scripts}/update/00-run.sh (92%) rename {bin => scripts}/update/01-run.sh (96%) rename {bin => scripts}/update/02-run.sh (100%) rename {bin => scripts}/update/03-run.sh (100%) rename {bin => scripts}/update/README.md (83%) diff --git a/bin/.gitkeep b/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/events/triggers/update b/events/triggers/update index 7577ef3..d6ae6ca 100755 --- a/events/triggers/update +++ b/events/triggers/update @@ -49,7 +49,7 @@ wget -qO- "https://raw.githubusercontent.com/getumbrel/umbrel/$RELEASE/install-b # Run update scripts echo "Running update install scripts of the new release" -cd bin/update +cd scripts/update UPDATE_INSTALL_SCRIPTS=$(ls *-run.sh) for script in $UPDATE_INSTALL_SCRIPTS; do if [[ -x $script ]]; then diff --git a/bin/update/.updateignore b/scripts/update/.updateignore similarity index 100% rename from bin/update/.updateignore rename to scripts/update/.updateignore diff --git a/bin/update/00-run.sh b/scripts/update/00-run.sh similarity index 92% rename from bin/update/00-run.sh rename to scripts/update/00-run.sh index 334d629..78ceb52 100755 --- a/bin/update/00-run.sh +++ b/scripts/update/00-run.sh @@ -34,7 +34,7 @@ chown -R 1000:1000 "$UMBREL_ROOT"/ echo "Backing up existing directory tree" rsync -av "$UMBREL_ROOT"/ \ - --exclude-from="$UMBREL_ROOT/.umbrel-$RELEASE/bin/update/.updateignore" \ + --exclude-from="$UMBREL_ROOT/.umbrel-$RELEASE/scripts/update/.updateignore" \ "$UMBREL_ROOT"/.umbrel-backup/ echo "Successfully backed up to $UMBREL_ROOT/.umbrel-backup" diff --git a/bin/update/01-run.sh b/scripts/update/01-run.sh similarity index 96% rename from bin/update/01-run.sh rename to scripts/update/01-run.sh index a088a37..c30eaf3 100755 --- a/bin/update/01-run.sh +++ b/scripts/update/01-run.sh @@ -68,7 +68,7 @@ cd "$UMBREL_ROOT" # Overlay home dir structure with new dir tree echo "Overlaying $UMBREL_ROOT/ with new directory tree" rsync -av "$UMBREL_ROOT"/.umbrel-"$RELEASE"/ \ - --exclude-from="$UMBREL_ROOT/.umbrel-$RELEASE/bin/update/.updateignore" \ + --exclude-from="$UMBREL_ROOT/.umbrel-$RELEASE/scripts/update/.updateignore" \ "$UMBREL_ROOT"/ # Fix permissions diff --git a/bin/update/02-run.sh b/scripts/update/02-run.sh similarity index 100% rename from bin/update/02-run.sh rename to scripts/update/02-run.sh diff --git a/bin/update/03-run.sh b/scripts/update/03-run.sh similarity index 100% rename from bin/update/03-run.sh rename to scripts/update/03-run.sh diff --git a/bin/update/README.md b/scripts/update/README.md similarity index 83% rename from bin/update/README.md rename to scripts/update/README.md index d6c9751..f08353d 100644 --- a/bin/update/README.md +++ b/scripts/update/README.md @@ -54,10 +54,10 @@ How over-the-air updates work on Umbrel. 16. `$UMBREL_ROOT/events/triggers/update` then executes all of the following update scripts from the new release `$UMBREL_ROOT/.umbrel-vX.Y.Z` one-by-one: -- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/bin/update/00-run.sh`](https://github.com/getumbrel/umbrel/blob/master/bin/update/00-run.sh): Pre-update preparation script (does things like making a backup) -- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/bin/update/01-run.sh`](https://github.com/getumbrel/umbrel/blob/master/bin/update/01-run.sh): Install update script (installs the update) -- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/bin/update/02-run.sh`](https://github.com/getumbrel/umbrel/blob/master/bin/update/02-run.sh): Post-update script (used to run unit-tests to make sure the update was successfully installed) -- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/bin/update/03-run.sh`](https://github.com/getumbrel/umbrel/blob/master/bin/update/03-run.sh): Success script (runs after the updated has been successfully downloaded and installed) +- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/scripts/update/00-run.sh`](https://github.com/getumbrel/umbrel/blob/master/scripts/update/00-run.sh): Pre-update preparation script (does things like making a backup) +- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/scripts/update/01-run.sh`](https://github.com/getumbrel/umbrel/blob/master/scripts/update/01-run.sh): Install update script (installs the update) +- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/scripts/update/02-run.sh`](https://github.com/getumbrel/umbrel/blob/master/scripts/update/02-run.sh): Post-update script (used to run unit-tests to make sure the update was successfully installed) +- [`$UMBREL_ROOT/.umbrel-vX.Y.Z/scripts/update/03-run.sh`](https://github.com/getumbrel/umbrel/blob/master/scripts/update/03-run.sh): Success script (runs after the updated has been successfully downloaded and installed) All of the above scripts continuously update `$UMBREL_ROOT/statuses/update-status.json` with the progress of update, which the dashboard periodically fetches every 2s via `umbrel-manager` to keep the user updated.