fixes
This commit is contained in:
parent
739f3bf8bb
commit
c9c5113e16
@ -4,15 +4,11 @@
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
|
||||
load_functions
|
||||
echo "(alpine-install.func) Loaded core.func via curl"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
|
||||
load_functions
|
||||
echo "(alpine-install.func) Loaded core.func via wget"
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
apk update && apk add curl >/dev/null 2>&1
|
||||
fi
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
|
||||
load_functions
|
||||
|
||||
# Function to set STD mode based on verbosity
|
||||
set_std_mode() {
|
||||
|
@ -68,6 +68,41 @@ default_vars() {
|
||||
i=$RETRY_NUM
|
||||
}
|
||||
|
||||
__curl_err_handler() {
|
||||
local exit_code="$1"
|
||||
local cmd="${BASH_COMMAND:-unknown}"
|
||||
if ! grep -q 'curl' <<<"$cmd"; then
|
||||
return
|
||||
fi
|
||||
|
||||
case $exit_code in
|
||||
1) msg_error "Unsupported protocol in: $cmd" ;;
|
||||
2) msg_error "Failed curl initialization in: $cmd" ;;
|
||||
3) msg_error "Malformed URL in: $cmd" ;;
|
||||
5) msg_error "Could not resolve proxy in: $cmd" ;;
|
||||
6) msg_error "Could not resolve host in: $cmd" ;;
|
||||
7) msg_error "Failed to connect to host in: $cmd" ;;
|
||||
9) msg_error "Access denied to remote resource in: $cmd" ;;
|
||||
18) msg_error "Partial file transfer detected in: $cmd" ;;
|
||||
22) msg_error "HTTP error response in: $cmd" ;;
|
||||
23) msg_error "Write error during transfer in: $cmd" ;;
|
||||
26) msg_error "Read error from local file in: $cmd" ;;
|
||||
28) msg_error "Operation timed out in: $cmd" ;;
|
||||
35) msg_error "SSL connect error in: $cmd" ;;
|
||||
47) msg_error "Too many redirects in: $cmd" ;;
|
||||
51) msg_error "SSL certificate verification failed in: $cmd" ;;
|
||||
52) msg_error "Empty response from server in: $cmd" ;;
|
||||
55) msg_error "Send error during transfer in: $cmd" ;;
|
||||
56) msg_error "Receive error during transfer in: $cmd" ;;
|
||||
60) msg_error "SSL CA certificate not trusted in: $cmd" ;;
|
||||
67) msg_error "Login denied by server in: $cmd" ;;
|
||||
78) msg_error "Remote file not found (404) in: $cmd" ;;
|
||||
*) msg_error "Unhandled curl error (exit $exit_code) in: $cmd" ;;
|
||||
esac
|
||||
|
||||
exit_script
|
||||
}
|
||||
|
||||
# This function displays an informational message with logging support.
|
||||
declare -A MSG_INFO_SHOWN
|
||||
SPINNER_ACTIVE=0
|
||||
|
@ -6,13 +6,10 @@
|
||||
# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
echo "[INFO] curl not found, setup."
|
||||
apt-get update && apt-get install -y curl >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
|
||||
load_functions
|
||||
echo "(install.func) Loaded core.func via curl"
|
||||
|
||||
# Function to set STD mode based on verbosity
|
||||
set_std_mode() {
|
||||
|
@ -928,38 +928,3 @@ function setup_gs() {
|
||||
msg_error "Ghostscript installation failed"
|
||||
fi
|
||||
}
|
||||
|
||||
__curl_err_handler() {
|
||||
local exit_code="$1"
|
||||
local cmd="${BASH_COMMAND:-unknown}"
|
||||
if ! grep -q 'curl' <<<"$cmd"; then
|
||||
return
|
||||
fi
|
||||
|
||||
case $exit_code in
|
||||
1) msg_error "Unsupported protocol in: $cmd" ;;
|
||||
2) msg_error "Failed curl initialization in: $cmd" ;;
|
||||
3) msg_error "Malformed URL in: $cmd" ;;
|
||||
5) msg_error "Could not resolve proxy in: $cmd" ;;
|
||||
6) msg_error "Could not resolve host in: $cmd" ;;
|
||||
7) msg_error "Failed to connect to host in: $cmd" ;;
|
||||
9) msg_error "Access denied to remote resource in: $cmd" ;;
|
||||
18) msg_error "Partial file transfer detected in: $cmd" ;;
|
||||
22) msg_error "HTTP error response in: $cmd" ;;
|
||||
23) msg_error "Write error during transfer in: $cmd" ;;
|
||||
26) msg_error "Read error from local file in: $cmd" ;;
|
||||
28) msg_error "Operation timed out in: $cmd" ;;
|
||||
35) msg_error "SSL connect error in: $cmd" ;;
|
||||
47) msg_error "Too many redirects in: $cmd" ;;
|
||||
51) msg_error "SSL certificate verification failed in: $cmd" ;;
|
||||
52) msg_error "Empty response from server in: $cmd" ;;
|
||||
55) msg_error "Send error during transfer in: $cmd" ;;
|
||||
56) msg_error "Receive error during transfer in: $cmd" ;;
|
||||
60) msg_error "SSL CA certificate not trusted in: $cmd" ;;
|
||||
67) msg_error "Login denied by server in: $cmd" ;;
|
||||
78) msg_error "Remote file not found (404) in: $cmd" ;;
|
||||
*) msg_error "Unhandled curl error (exit $exit_code) in: $cmd" ;;
|
||||
esac
|
||||
|
||||
exit_script
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user