refactor(install): switch to release artifacts instead of git clone

This commit is contained in:
Whispering Wind
2025-09-11 23:18:49 +03:30
committed by GitHub
parent 87d6e6e6be
commit 66447ae898

View File

@ -119,7 +119,7 @@ install_mongodb() {
}
install_packages() {
local REQUIRED_PACKAGES=("jq" "curl" "pwgen" "python3" "python3-pip" "python3-venv" "git" "bc" "zip" "cron" "lsof" "golang-go" "gnupg" "lsb-release")
local REQUIRED_PACKAGES=("jq" "curl" "pwgen" "python3" "python3-pip" "python3-venv" "bc" "zip" "lsof" "gnupg" "lsb-release")
local MISSING_PACKAGES=()
log_info "Checking required packages..."
@ -153,26 +153,62 @@ install_packages() {
install_mongodb
}
clone_repository() {
log_info "Cloning Blitz repository..."
download_and_extract_release() {
log_info "Downloading and extracting Blitz panel..."
if [ -d "/etc/hysteria" ]; then
log_warning "Directory /etc/hysteria already exists."
read -p "Do you want to remove it and clone again? (y/n): " -n 1 -r
read -p "Do you want to remove it and install again? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf /etc/hysteria
else
log_info "Using existing directory."
log_info "Skipping download. Using existing directory."
return 0
fi
fi
if git clone https://github.com/ReturnFI/Blitz /etc/hysteria &> /dev/null; then
log_success "Repository cloned successfully"
else
log_error "Failed to clone repository"
local arch
case $(uname -m) in
x86_64) arch="amd64" ;;
aarch64) arch="arm64" ;;
*)
log_error "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
log_info "Detected architecture: $arch"
local zip_name="Blitz-${arch}.zip"
local download_url="https://github.com/ReturnFI/Blitz/releases/latest/download/${zip_name}"
local temp_zip="/tmp/${zip_name}"
log_info "Downloading from ${download_url}..."
if curl -sL -o "$temp_zip" "$download_url"; then
log_success "Download complete."
else
log_error "Failed to download the release asset. Please check the URL and your connection."
exit 1
fi
log_info "Extracting to /etc/hysteria..."
mkdir -p /etc/hysteria
if unzip -q "$temp_zip" -d /etc/hysteria; then
log_success "Extracted successfully."
else
log_error "Failed to extract the archive."
exit 1
fi
rm "$temp_zip"
log_info "Cleaned up temporary file."
local auth_binary="/etc/hysteria/core/scripts/auth/user_auth"
if [ -f "$auth_binary" ]; then
chmod +x "$auth_binary"
log_success "Set execute permission for auth binary."
else
log_warning "Auth binary not found at $auth_binary. The installation might be incomplete."
fi
}
@ -227,7 +263,7 @@ main() {
check_root
check_os_version
install_packages
clone_repository
download_and_extract_release
setup_python_env
add_alias