diff --git a/scripts/update/01-run.sh b/scripts/update/01-run.sh index 389e11f..5b0617b 100755 --- a/scripts/update/01-run.sh +++ b/scripts/update/01-run.sh @@ -4,6 +4,9 @@ set -euo pipefail RELEASE=$1 UMBREL_ROOT=$2 +# Only used on Umbrel OS +SD_CARD_UMBREL_ROOT="/sd-root${UMBREL_ROOT}" + echo echo "=======================================" echo "============= OTA UPDATE ==============" @@ -12,6 +15,35 @@ echo "=========== Stage: Install ============" echo "=======================================" echo +[[ -f "/etc/default/umbrel" ]] && source "/etc/default/umbrel" + +# Make Umbrel OS specific updates +if [[ ! -z "${UMBREL_OS:-}" ]]; then + echo + echo "=============================================" + echo "Installing on Umbrel OS $UMBREL_OS" + echo "=============================================" + echo + + # Update SD card installation + if [[ -f "${SD_CARD_UMBREL_ROOT}/.umbrel" ]]; then + echo "Replacing ${SD_CARD_UMBREL_ROOT} on SD card with the new release" + rsync --archive \ + --verbose \ + --include-from="${UMBREL_ROOT}/.umbrel-${RELEASE}/scripts/update/.updateinclude" \ + --exclude-from="${UMBREL_ROOT}/.umbrel-${RELEASE}/scripts/update/.updateignore" \ + --delete \ + "${UMBREL_ROOT}/.umbrel-${RELEASE}/" \ + "${SD_CARD_UMBREL_ROOT}/" + + echo "Fixing permissions" + chown -R 1000:1000 "${SD_CARD_UMBREL_ROOT}/" + else + echo "ERROR: No Umbrel installation found at SD root ${SD_CARD_UMBREL_ROOT}" + echo "Skipping updating on SD Card..." + fi +fi + cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 33, "description": "Configuring settings", "updateTo": "$RELEASE"} EOF @@ -39,9 +71,11 @@ cd "$UMBREL_ROOT" # Overlay home dir structure with new dir tree echo "Overlaying $UMBREL_ROOT/ with new directory tree" -rsync -av \ +rsync --archive \ + --verbose \ --include-from="$UMBREL_ROOT/.umbrel-$RELEASE/scripts/update/.updateinclude" \ --exclude-from="$UMBREL_ROOT/.umbrel-$RELEASE/scripts/update/.updateignore" \ + --delete \ "$UMBREL_ROOT"/.umbrel-"$RELEASE"/ \ "$UMBREL_ROOT"/