From d1893af96fa68dc399bc8d7d3679b617337a4d2e Mon Sep 17 00:00:00 2001 From: Sefinek Date: Tue, 19 Nov 2024 05:01:06 +0100 Subject: [PATCH] Bugfix for install.sh --- install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 1cfad15..0694795 100644 --- a/install.sh +++ b/install.sh @@ -34,20 +34,20 @@ about the latest changes and more: https://discord.gg/53DBjTuzgZ EOF -# Function to download a file using either wget or curl +# Function to download a file using either curl or wget download_file() { local url="$1" local output="$2" local user_agent="UFW-AbuseIPDB-Reporter/$VERSION (+$REPO)" - if command -v wget >/dev/null 2>&1; then - echo "INFO: Using 'wget' to download the file..." - sudo wget --header="User-Agent: $user_agent" -O "$output" "$url" - elif command -v curl >/dev/null 2>&1; then - echo "INFO: 'wget' is not installed. Switching to 'curl' to download the file..." + if command -v curl >/dev/null 2>&1; then + echo "INFO: Using 'curl' to download the file..." sudo curl -A "$user_agent" -o "$output" "$url" + elif command -v wget >/dev/null 2>&1; then + echo "INFO: 'curl' is not installed. Using 'wget' to download the file..." + sudo wget --header="User-Agent: $user_agent" -O "$output" "$url" else - echo "FAIL: Neither 'wget' nor 'curl' is installed! Please install one of these packages and try running the script again." + echo "FAIL: Neither 'curl' nor 'wget' is installed! Please install one of these packages and try running the script again." exit 1 fi } @@ -141,8 +141,8 @@ echo # =========================== Prepare reporter.sh script =========================== -GITHUB_URL="https://raw.githubusercontent.com/sefinek/UFW-AbuseIPDB-Reporter/main/reporter.sh..." -echo "INFO: Downloading reporter.sh from $GITHUB_URL" +GITHUB_URL="https://raw.githubusercontent.com/sefinek/UFW-AbuseIPDB-Reporter/main/reporter.sh" +echo "INFO: Downloading reporter.sh from $GITHUB_URL..." if ! download_file "$GITHUB_URL" "$script_path"; then echo "FAIL: Something went wrong while downloading the file from GitHub servers! Maybe try running this script as sudo?" exit 1 @@ -176,7 +176,7 @@ while [[ $attempts -lt $max_attempts ]]; do done if [[ "$valid_token" = false ]]; then - echo "FAIL: Maximum number of attempts reached. Installation aborted!" + echo -e "\nFAIL: Maximum number of attempts reached. Installation aborted!" exit 1 fi