Skip to content
This repository was archived by the owner on Jul 8, 2026. It is now read-only.

Commit 1a01721

Browse files
committed
refactor(upgrade): streamline backup process and remove geo data download
1 parent 5f86cc9 commit 1a01721

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

upgrade.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ trap 'echo -e "\n❌ An error occurred. Aborting."; exit 1' ERR
66
# ========== Variables ==========
77
HYSTERIA_INSTALL_DIR="/etc/hysteria"
88
HYSTERIA_VENV_DIR="$HYSTERIA_INSTALL_DIR/hysteria2_venv"
9-
GEOSITE_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
10-
GEOIP_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
119
MIGRATE_SCRIPT_PATH="$HYSTERIA_INSTALL_DIR/core/scripts/db/migrate_users.py"
1210

1311
# ========== Color Setup ==========
@@ -225,7 +223,7 @@ fix_caddy_repo
225223
install_mongodb
226224

227225
# ========== Migrate NormalSub Path (if necessary) ==========
228-
migrate_normalsub_path
226+
# migrate_normalsub_path
229227

230228
# ========== Backup Files ==========
231229
cd /root
@@ -238,42 +236,38 @@ FILES=(
238236
"$HYSTERIA_INSTALL_DIR/.configs.env"
239237
"$HYSTERIA_INSTALL_DIR/nodes.json"
240238
"$HYSTERIA_INSTALL_DIR/extra.json"
239+
"$HYSTERIA_INSTALL_DIR/geosite.dat"
240+
"$HYSTERIA_INSTALL_DIR/geoip.dat"
241241
"$HYSTERIA_INSTALL_DIR/core/scripts/telegrambot/.env"
242242
"$HYSTERIA_INSTALL_DIR/core/scripts/normalsub/.env"
243243
"$HYSTERIA_INSTALL_DIR/core/scripts/normalsub/Caddyfile.normalsub"
244244
"$HYSTERIA_INSTALL_DIR/core/scripts/webpanel/.env"
245245
"$HYSTERIA_INSTALL_DIR/core/scripts/webpanel/Caddyfile"
246246
)
247247

248-
info "Backing up configuration files to: $TEMP_DIR"
248+
info "Backing up configuration and data files to: $TEMP_DIR"
249249
for FILE in "${FILES[@]}"; do
250250
if [[ -f "$FILE" ]]; then
251251
mkdir -p "$TEMP_DIR/$(dirname "$FILE")"
252252
cp -p "$FILE" "$TEMP_DIR/$FILE"
253253
success "Backed up: $FILE"
254254
else
255-
warn "File not found: $FILE"
255+
warn "File not found, skipping backup: $FILE"
256256
fi
257257
done
258258

259259
# ========== Download and Replace Installation ==========
260260
download_and_extract_latest_release
261261

262-
# ========== Download Geo Data ==========
263-
info "Downloading geosite.dat and geoip.dat..."
264-
wget -q -O "$HYSTERIA_INSTALL_DIR/geosite.dat" "$GEOSITE_URL"
265-
wget -q -O "$HYSTERIA_INSTALL_DIR/geoip.dat" "$GEOIP_URL"
266-
success "Geo data downloaded."
267-
268262
# ========== Restore Backup ==========
269-
info "Restoring configuration files..."
263+
info "Restoring configuration and data files..."
270264
for FILE in "${FILES[@]}"; do
271265
BACKUP="$TEMP_DIR/$FILE"
272266
if [[ -f "$BACKUP" ]]; then
273267
cp -p "$BACKUP" "$FILE"
274268
success "Restored: $FILE"
275269
else
276-
warn "Missing backup file: $BACKUP"
270+
warn "Missing backup file, skipping restore: $BACKUP"
277271
fi
278272
done
279273

0 commit comments

Comments
 (0)