From 56ef66596ba98f8dfca3699e4abc36aca428988b Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Fri, 27 Dec 2024 23:44:46 -0300 Subject: [PATCH] Update HTTP response check --- backup.sh | 2 +- clean.sh | 2 +- scripts-download.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backup.sh b/backup.sh index 6f2e36b..64c9939 100644 --- a/backup.sh +++ b/backup.sh @@ -6,7 +6,7 @@ SERVER_FILE="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/backup. SERVER_OK=1 # Check if the server file exists -curl -s --head $SERVER_FILE | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null +curl -s --head $SERVER_FILE | head -n 1 | grep -E "HTTP/[12] [23].." > /dev/null if [ $? -ne 0 ]; then echo "Error: $SERVER_FILE not found." >&2 diff --git a/clean.sh b/clean.sh index 3b50e94..9104857 100644 --- a/clean.sh +++ b/clean.sh @@ -6,7 +6,7 @@ SERVER_FILE="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/clean.s SERVER_OK=1 # Check if the server file exists -curl -s --head $SERVER_FILE | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null +curl -s --head $SERVER_FILE | head -n 1 | grep -E "HTTP/[12] [23].." > /dev/null if [ $? -ne 0 ]; then echo "Error: $SERVER_FILE not found." >&2 diff --git a/scripts-download.sh b/scripts-download.sh index 90cfc59..f6f7487 100644 --- a/scripts-download.sh +++ b/scripts-download.sh @@ -15,7 +15,7 @@ YELLOW='\033[1;33m' FILES_URL="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main" -echo -ne "\r${LIGHT_BLUE}[i] Running scripts-download.sh" +echo -e "\r${LIGHT_BLUE}[i] Running scripts-download.sh" # Detect OS (Debian or Alpine) echo -e "${GREY}[i] Detecting OS..." @@ -110,7 +110,7 @@ FILES=("clean.sh" "backup.sh") # Check connection with the server for all files echo -e "${GREY}[i] Checking connection with the server..." for FILE in "${FILES[@]}"; do - curl -s --head "$FILES_URL/$FILE" | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null + curl -s --head "$FILES_URL/$FILE" | head -n 1 | grep -E "HTTP/[12] [23].." > /dev/null if [ $? -ne 0 ]; then echo -e "${RED}[x] Error: $FILE not found on the server.${NC}" >&2