Browse Source

Install OTA update on both SD card and SSD (#115)

check-external-filesystem
Mayank Chhabra 4 years ago
committed by GitHub
parent
commit
3436e06cd3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      scripts/update/01-run.sh

36
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 <<EOF > "$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"/

Loading…
Cancel
Save