From 66447ae8982e63c78b686a9aedf454cd05e8abbd Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:18:49 +0330 Subject: [PATCH] refactor(install): switch to release artifacts instead of git clone --- install.sh | 60 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index e48f7f3..bdb4d71 100644 --- a/install.sh +++ b/install.sh @@ -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,27 +153,63 @@ 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" + + 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 clone repository" + 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 } setup_python_env() { @@ -227,7 +263,7 @@ main() { check_root check_os_version install_packages - clone_repository + download_and_extract_release setup_python_env add_alias @@ -239,4 +275,4 @@ main() { run_menu } -main +main \ No newline at end of file