33set -euo pipefail
44trap ' echo -e "\n❌ An error occurred. Aborting."; exit 1' ERR
55
6- # ========== Variables ==========
7- HYSTERIA_INSTALL_DIR=" /etc/hysteria"
8- 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"
11- MIGRATE_SCRIPT_PATH=" $HYSTERIA_INSTALL_DIR /core/scripts/db/migrate_users.py"
12-
136# ========== Color Setup ==========
147GREEN=$( tput setaf 2)
158RED=$( tput setaf 1)
@@ -22,6 +15,26 @@ success() { echo -e "${GREEN}[$(date '+%Y-%m-%d %H:%M:%S')] [OK] - ${RESET} $1";
2215warn () { echo -e " ${YELLOW} [$( date ' +%Y-%m-%d %H:%M:%S' ) ] [WARN] - ${RESET} $1 " ; }
2316error () { echo -e " ${RED} [$( date ' +%Y-%m-%d %H:%M:%S' ) ] [ERROR] - ${RESET} $1 " ; }
2417
18+ # ========== Variables and Argument Parsing ==========
19+ echo " Usage: $0 [beta]"
20+ echo " (no argument) - Upgrades to the latest stable release."
21+ echo " beta - Upgrades to the latest beta pre-release."
22+ echo " --------------------------------------------------------"
23+
24+ RELEASE_TAG=" beta"
25+ if [[ " ${1:- } " == " beta" ]]; then
26+ info " Beta flag detected. Targeting beta pre-release."
27+ RELEASE_TAG=" beta"
28+ else
29+ info " Targeting the latest stable release."
30+ fi
31+
32+ HYSTERIA_INSTALL_DIR=" /etc/hysteria"
33+ HYSTERIA_VENV_DIR=" $HYSTERIA_INSTALL_DIR /hysteria2_venv"
34+ GEOSITE_URL=" https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
35+ GEOIP_URL=" https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
36+ MIGRATE_SCRIPT_PATH=" $HYSTERIA_INSTALL_DIR /core/scripts/db/migrate_users.py"
37+
2538# ========== Check AVX Support ==========
2639check_avx_support () {
2740 info " Checking CPU for AVX support (required for MongoDB)..."
@@ -94,7 +107,7 @@ migrate_json_to_mongo() {
94107 fi
95108}
96109
97- download_and_extract_latest_release () {
110+ download_and_extract_release () {
98111 local arch
99112 case $( uname -m) in
100113 x86_64) arch=" amd64" ;;
@@ -107,10 +120,10 @@ download_and_extract_latest_release() {
107120 info " Detected architecture: $arch "
108121
109122 local zip_name=" Blitz-${arch} .zip"
110- local download_url=" https://github.com/ReturnFI/Blitz/releases/latest/ download/${zip_name} "
123+ local download_url=" https://github.com/ReturnFI/Blitz/releases/download/ ${RELEASE_TAG} /${zip_name} "
111124 local temp_zip=" /tmp/${zip_name} "
112125
113- info " Downloading latest release from ${download_url} ..."
126+ info " Downloading release from ${download_url} ..."
114127 if ! curl -sL -o " $temp_zip " " $download_url " ; then
115128 error " Failed to download the release asset. Please check the URL and your connection."
116129 exit 1
@@ -190,7 +203,7 @@ for FILE in "${FILES[@]}"; do
190203done
191204
192205# ========== Download and Replace Installation ==========
193- download_and_extract_latest_release
206+ download_and_extract_release
194207
195208# ========== Download Geo Data ==========
196209info " Downloading geosite.dat and geoip.dat..."
0 commit comments