#!/usr/bin/env bash set -euo pipefail RELEASE=$1 UMBREL_ROOT=$2 echo echo "=======================================" echo "============= OTA UPDATE ==============" echo "=======================================" echo "=========== Stage: Install ============" echo "=======================================" echo cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 33, "description": "Configuring settings", "updateTo": "$RELEASE"} EOF # Checkout to the new release cd "$UMBREL_ROOT"/.umbrel-"$RELEASE" # Configure new install echo "Configuring new release" cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 40, "description": "Configuring new release", "updateTo": "$RELEASE"} EOF BITCOIN_NETWORK="mainnet" [[ -f "$UMBREL_ROOT/.env" ]] && source "$UMBREL_ROOT/.env" NETWORK=$BITCOIN_NETWORK ./scripts/configure # Stop existing containers echo "Stopping existing containers" cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 70, "description": "Removing old containers", "updateTo": "$RELEASE"} EOF cd "$UMBREL_ROOT" ./scripts/stop # Overlay home dir structure with new dir tree echo "Overlaying $UMBREL_ROOT/ with new directory tree" rsync -av \ --include-from="$UMBREL_ROOT/.umbrel-$RELEASE/scripts/update/.updateinclude" \ --exclude-from="$UMBREL_ROOT/.umbrel-$RELEASE/scripts/update/.updateignore" \ "$UMBREL_ROOT"/.umbrel-"$RELEASE"/ \ "$UMBREL_ROOT"/ # Fix permissions echo "Fixing permissions" chown -R 1000:1000 "$UMBREL_ROOT"/ chmod -R 700 "$UMBREL_ROOT"/tor/data/* # Start updated containers echo "Starting new containers" cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 80, "description": "Starting new containers", "updateTo": "$RELEASE"} EOF cd "$UMBREL_ROOT" ./scripts/start