refactor(install): switch to release artifacts instead of git clone
This commit is contained in:
54
install.sh
54
install.sh
@ -119,7 +119,7 @@ install_mongodb() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_packages() {
|
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=()
|
local MISSING_PACKAGES=()
|
||||||
|
|
||||||
log_info "Checking required packages..."
|
log_info "Checking required packages..."
|
||||||
@ -153,27 +153,63 @@ install_packages() {
|
|||||||
install_mongodb
|
install_mongodb
|
||||||
}
|
}
|
||||||
|
|
||||||
clone_repository() {
|
download_and_extract_release() {
|
||||||
log_info "Cloning Blitz repository..."
|
log_info "Downloading and extracting Blitz panel..."
|
||||||
|
|
||||||
if [ -d "/etc/hysteria" ]; then
|
if [ -d "/etc/hysteria" ]; then
|
||||||
log_warning "Directory /etc/hysteria already exists."
|
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
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
rm -rf /etc/hysteria
|
rm -rf /etc/hysteria
|
||||||
else
|
else
|
||||||
log_info "Using existing directory."
|
log_info "Skipping download. Using existing directory."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if git clone https://github.com/ReturnFI/Blitz /etc/hysteria &> /dev/null; then
|
local arch
|
||||||
log_success "Repository cloned successfully"
|
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
|
else
|
||||||
log_error "Failed to clone repository"
|
log_error "Failed to download the release asset. Please check the URL and your connection."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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() {
|
setup_python_env() {
|
||||||
@ -227,7 +263,7 @@ main() {
|
|||||||
check_root
|
check_root
|
||||||
check_os_version
|
check_os_version
|
||||||
install_packages
|
install_packages
|
||||||
clone_repository
|
download_and_extract_release
|
||||||
setup_python_env
|
setup_python_env
|
||||||
add_alias
|
add_alias
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user