Skip to content

Commit

Permalink
Migrate 0.5.2 Tor dependent apps on update
Browse files Browse the repository at this point in the history

Co-authored-by: Steven Briscoe <me@stevenbriscoe.com>
Co-authored-by: Luke Childs <lukechilds123@gmail.com>
  • Loading branch information
3 people authored Oct 13, 2022
1 parent 37f08cf commit fa8b256
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 23 deletions.
3 changes: 2 additions & 1 deletion scripts/update/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ rsync --archive \
"$UMBREL_ROOT"/

# Add user setting to enable/disable remote tor access
"${UMBREL_ROOT}/scripts/update/steps/add-remote-tor-access.sh" "$RELEASE" "$UMBREL_ROOT"
# TODO: Remove this on next Umbrel update and update required ota version to avoid repeatedly updating apps.
"${UMBREL_ROOT}/scripts/update/steps/support-remote-tor-access.sh" "$RELEASE" "$UMBREL_ROOT"

# Fix permissions
echo "Fixing permissions"
Expand Down
22 changes: 0 additions & 22 deletions scripts/update/steps/add-remote-tor-access.sh

This file was deleted.

38 changes: 38 additions & 0 deletions scripts/update/steps/support-remote-tor-access.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail

RELEASE=$1
UMBREL_ROOT=$2

USER_FILE="${UMBREL_ROOT}/db/user.json"

HAS_REMOTE_TOR_ACCESS=$(cat "${USER_FILE}" | jq 'has("remoteTorAccess")')

if [[ "${HAS_REMOTE_TOR_ACCESS}" == "true" ]]; then
echo "'remoteTorAccess' user setting already setup..."

exit
fi

echo "Adding 'remoteTorAccess' user setting..."

# Default to true for existing Umbrel users
# The default for new installs will be false
jq ".remoteTorAccess = true" "${USER_FILE}" > /tmp/user.json
mv /tmp/user.json "${USER_FILE}"

# Due to changes with how we handle app's Tor HSes
# We need update the affected apps

# Ensure we've pulled in all the latest app updates
"${UMBREL_ROOT}/scripts/repo" update || true

affected_apps="bitcoin core-lightning electrs elements gitea jam kollider lightning samourai-server sphinx-relay squeaknode suredbits-wallet synapse"

for app in $affected_apps
do
if "${UMBREL_ROOT}/scripts/app" ls-installed | grep --quiet "${app}"
then
"${UMBREL_ROOT}/scripts/app" update "${app}" --skip-stop --skip-start || true
fi
done

0 comments on commit fa8b256

Please sign in to comment.