mirror of https://github.com/lukechilds/umbrel.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
RELEASE=$1
|
|
UMBREL_ROOT=$2
|
|
|
|
./check-memory "${RELEASE}" "${UMBREL_ROOT}" "firstrun"
|
|
|
|
echo
|
|
echo "======================================="
|
|
echo "=============== UPDATE ================"
|
|
echo "======================================="
|
|
echo "========= Stage: Pre-update ==========="
|
|
echo "======================================="
|
|
echo
|
|
|
|
# Make sure any previous backup doesn't exist
|
|
if [[ -d "$UMBREL_ROOT"/.umbrel-backup ]]; then
|
|
echo "Cannot install update. A previous backup already exists at $UMBREL_ROOT/.umbrel-backup"
|
|
echo "This can only happen if the previous update installation wasn't successful"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Installing Umbrel $RELEASE at $UMBREL_ROOT"
|
|
|
|
# Update status file
|
|
cat <<EOF > "$UMBREL_ROOT"/statuses/update-status.json
|
|
{"state": "installing", "progress": 20, "description": "Backing up", "updateTo": "$RELEASE"}
|
|
EOF
|
|
|
|
# Fix permissions
|
|
echo "Fixing permissions"
|
|
find "$UMBREL_ROOT" -path "$UMBREL_ROOT/app-data" -prune -o -exec chown 1000:1000 {} +
|
|
|
|
# Backup
|
|
echo "Backing up existing 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_ROOT"/.umbrel-backup/
|
|
|
|
echo "Successfully backed up to $UMBREL_ROOT/.umbrel-backup"
|
|
|