summaryrefslogtreecommitdiff
path: root/update_gotify.sh
diff options
context:
space:
mode:
authorSam Scholten2025-10-22 16:44:53 +1000
committerSam Scholten2025-10-22 16:44:53 +1000
commit61ca95ae5929928ebfa50b8d99b18cf21c3e2ca7 (patch)
tree0124c23545f21aee35107efb42a7827bb93e3179 /update_gotify.sh
parent4352c0aedd3236b805977da8fc910fb8f46a9e2d (diff)
downloaddrestic-f8ddb9986fe7f7cbc25c5bddd1d50ed5f904b981.tar.gz
drestic-f8ddb9986fe7f7cbc25c5bddd1d50ed5f904b981.zip
Fix: Replace unsupported restic flags for 0.18.1 compatibilityv1.2
- Replace --lock-retry-after and --lock-stale-timeout with --retry-lock - Fix shell script quoting issues (SC2086, SC2046) - All tests passing: local, remote, lint, format
Diffstat (limited to 'update_gotify.sh')
-rwxr-xr-xupdate_gotify.sh92
1 files changed, 46 insertions, 46 deletions
diff --git a/update_gotify.sh b/update_gotify.sh
index 5305752..0695507 100755
--- a/update_gotify.sh
+++ b/update_gotify.sh
@@ -4,8 +4,8 @@ set -euo pipefail
ENV_FILE="$1"
if [ ! -f "$ENV_FILE" ]; then
- echo "Error: Environment file not found: $ENV_FILE"
- exit 1
+ echo "Error: Environment file not found: $ENV_FILE"
+ exit 1
fi
echo "Current Gotify configuration:"
@@ -14,58 +14,58 @@ echo
read -rp "Enter new Gotify URL (no trailing slash, e.g. https://gotify.example.com): " GOTIFY_URL
if [ -n "$GOTIFY_URL" ]; then
- # Validate URL format
- if [[ ! "$GOTIFY_URL" =~ ^https?:// ]]; then
- echo "Error: Invalid URL format (must start with http:// or https://)"
- exit 1
- fi
-
- # Test URL reachability
- echo "Testing Gotify server connectivity..."
- if ! curl -s --connect-timeout 10 "$GOTIFY_URL/health" >/dev/null 2>&1; then
- echo "Warning: Cannot reach Gotify server at $GOTIFY_URL"
- echo "This might be due to network issues or incorrect URL."
- read -rp "Continue anyway? [y/N]: " continue_anyway
- if [[ ! "$continue_anyway" =~ ^[Yy]$ ]]; then
- echo "Aborted."
- exit 1
- fi
- else
- echo "✓ Gotify server is reachable"
- fi
-
- read -rp "Enter new Gotify token: " GOTIFY_TOKEN
-
- # Test token if both URL and token are provided
- if [ -n "$GOTIFY_TOKEN" ]; then
- echo "Testing Gotify token..."
- if curl -sS "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" \
- -F "title=DRestic Config Test ($(whoami)@$(hostname))" \
- -F "message=Testing Gotify configuration from $(whoami)@$(hostname) - you can ignore this message" \
- -F "priority=1" >/dev/null 2>&1; then
- echo "✓ Test notification sent successfully!"
- else
- echo "Warning: Failed to send test notification. Please verify your token."
- read -rp "Continue anyway? [y/N]: " continue_anyway
- if [[ ! "$continue_anyway" =~ ^[Yy]$ ]]; then
- echo "Aborted."
- exit 1
- fi
- fi
- fi
+ # Validate URL format
+ if [[ ! "$GOTIFY_URL" =~ ^https?:// ]]; then
+ echo "Error: Invalid URL format (must start with http:// or https://)"
+ exit 1
+ fi
+
+ # Test URL reachability
+ echo "Testing Gotify server connectivity..."
+ if ! curl -s --connect-timeout 10 "$GOTIFY_URL/health" >/dev/null 2>&1; then
+ echo "Warning: Cannot reach Gotify server at $GOTIFY_URL"
+ echo "This might be due to network issues or incorrect URL."
+ read -rp "Continue anyway? [y/N]: " continue_anyway
+ if [[ ! "$continue_anyway" =~ ^[Yy]$ ]]; then
+ echo "Aborted."
+ exit 1
+ fi
+ else
+ echo "✓ Gotify server is reachable"
+ fi
+
+ read -rp "Enter new Gotify token: " GOTIFY_TOKEN
+
+ # Test token if both URL and token are provided
+ if [ -n "$GOTIFY_TOKEN" ]; then
+ echo "Testing Gotify token..."
+ if curl -sS "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" \
+ -F "title=DRestic Config Test ($(whoami)@$(hostname))" \
+ -F "message=Testing Gotify configuration from $(whoami)@$(hostname) - you can ignore this message" \
+ -F "priority=1" >/dev/null 2>&1; then
+ echo "✓ Test notification sent successfully!"
+ else
+ echo "Warning: Failed to send test notification. Please verify your token."
+ read -rp "Continue anyway? [y/N]: " continue_anyway
+ if [[ ! "$continue_anyway" =~ ^[Yy]$ ]]; then
+ echo "Aborted."
+ exit 1
+ fi
+ fi
+ fi
else
- GOTIFY_TOKEN=""
+ GOTIFY_TOKEN=""
fi
# Update or add Gotify settings
sed -i '/^GOTIFY_URL=/d' "$ENV_FILE"
sed -i '/^GOTIFY_TOKEN=/d' "$ENV_FILE"
-echo "GOTIFY_URL=\"$GOTIFY_URL\"" >> "$ENV_FILE"
-echo "GOTIFY_TOKEN=\"$GOTIFY_TOKEN\"" >> "$ENV_FILE"
+echo "GOTIFY_URL=\"$GOTIFY_URL\"" >>"$ENV_FILE"
+echo "GOTIFY_TOKEN=\"$GOTIFY_TOKEN\"" >>"$ENV_FILE"
echo "✓ Gotify configuration updated!"
if [ -n "$GOTIFY_URL" ]; then
- echo "Test with: make test-remote-gotify"
+ echo "Test with: make test-remote-gotify"
else
- echo "Gotify notifications disabled"
+ echo "Gotify notifications disabled"
fi