mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Replace wget with curl -fsSL, normalize downloads, and prep for IPv6 (#3455)
* Initial Call, Switch from curl -s to curl -fsSL and wget to curl -fssL * more switches * switch vms * more curls * More curls * more * more * more changes * more * prepare ipv6 calls * change frontend to ipv6 * Formatting * Fromatting * Update gomft.sh * Update gomft-install.sh * Update ersatztv.sh * Update build.func --------- Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
This commit is contained in:
		@@ -5,8 +5,7 @@
 | 
			
		||||
# License: MIT
 | 
			
		||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
 | 
			
		||||
 | 
			
		||||
source /dev/stdin <<< $(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
 | 
			
		||||
 | 
			
		||||
source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
 | 
			
		||||
 | 
			
		||||
function header_info {
 | 
			
		||||
  clear
 | 
			
		||||
@@ -32,7 +31,7 @@ var_os="homeassistant"
 | 
			
		||||
DISK_SIZE="32G"
 | 
			
		||||
#
 | 
			
		||||
for version in "${VERSIONS[@]}"; do
 | 
			
		||||
  eval "$version=$(curl -s https://raw.githubusercontent.com/home-assistant/version/master/$version.json | grep "ova" | cut -d '"' -f 4)"
 | 
			
		||||
  eval "$version=$(curl -fsSL https://raw.githubusercontent.com/home-assistant/version/master/$version.json | grep "ova" | cut -d '"' -f 4)"
 | 
			
		||||
done
 | 
			
		||||
YW=$(echo "\033[33m")
 | 
			
		||||
BL=$(echo "\033[36m")
 | 
			
		||||
@@ -51,11 +50,11 @@ SPINNER_PID=""
 | 
			
		||||
set -Eeuo pipefail
 | 
			
		||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
 | 
			
		||||
trap cleanup EXIT
 | 
			
		||||
trap 'post_update_to_api "failed" "INTERRUPTED"' SIGINT 
 | 
			
		||||
trap 'post_update_to_api "failed" "INTERRUPTED"' SIGINT
 | 
			
		||||
trap 'post_update_to_api "failed" "TERMINATED"' SIGTERM
 | 
			
		||||
 | 
			
		||||
function error_handler() {
 | 
			
		||||
  if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
 | 
			
		||||
  if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
 | 
			
		||||
  printf "\e[?25h"
 | 
			
		||||
  local exit_code="$?"
 | 
			
		||||
  local line_number="$1"
 | 
			
		||||
@@ -87,13 +86,13 @@ else
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function spinner() {
 | 
			
		||||
    local chars="/-\|"
 | 
			
		||||
    local spin_i=0
 | 
			
		||||
    printf "\e[?25l"
 | 
			
		||||
    while true; do
 | 
			
		||||
        printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}"
 | 
			
		||||
        sleep 0.1
 | 
			
		||||
    done
 | 
			
		||||
  local chars="/-\|"
 | 
			
		||||
  local spin_i=0
 | 
			
		||||
  printf "\e[?25l"
 | 
			
		||||
  while true; do
 | 
			
		||||
    printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}"
 | 
			
		||||
    sleep 0.1
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function msg_info() {
 | 
			
		||||
@@ -104,14 +103,14 @@ function msg_info() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function msg_ok() {
 | 
			
		||||
  if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
 | 
			
		||||
  if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
 | 
			
		||||
  printf "\e[?25h"
 | 
			
		||||
  local msg="$1"
 | 
			
		||||
  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function msg_error() {
 | 
			
		||||
  if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
 | 
			
		||||
  if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
 | 
			
		||||
  printf "\e[?25h"
 | 
			
		||||
  local msg="$1"
 | 
			
		||||
  echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 | 
			
		||||
@@ -134,7 +133,7 @@ function pve_check() {
 | 
			
		||||
    echo -e "Exiting..."
 | 
			
		||||
    sleep 2
 | 
			
		||||
    exit
 | 
			
		||||
fi
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function arch_check() {
 | 
			
		||||
@@ -393,7 +392,6 @@ pve_check
 | 
			
		||||
ssh_check
 | 
			
		||||
start_script
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
post_to_api_vm
 | 
			
		||||
 | 
			
		||||
msg_info "Validating Storage"
 | 
			
		||||
@@ -416,7 +414,7 @@ elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then
 | 
			
		||||
  STORAGE=${STORAGE_MENU[0]}
 | 
			
		||||
else
 | 
			
		||||
  while [ -z "${STORAGE:+x}" ]; do
 | 
			
		||||
    if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
 | 
			
		||||
    if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
 | 
			
		||||
    printf "\e[?25h"
 | 
			
		||||
    STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \
 | 
			
		||||
      "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \
 | 
			
		||||
@@ -434,7 +432,7 @@ else
 | 
			
		||||
fi
 | 
			
		||||
sleep 2
 | 
			
		||||
msg_ok "${CL}${BL}${URL}${CL}"
 | 
			
		||||
wget -q --show-progress $URL
 | 
			
		||||
curl -fsSL -o "$(basename "$URL")" "$URL"
 | 
			
		||||
echo -en "\e[1A\e[0K"
 | 
			
		||||
FILE=$(basename $URL)
 | 
			
		||||
msg_ok "Downloaded ${CL}${BL}haos_ova-${BRANCH}.qcow2.xz${CL}"
 | 
			
		||||
@@ -485,5 +483,3 @@ if [ "$START_VM" == "yes" ]; then
 | 
			
		||||
fi
 | 
			
		||||
post_update_to_api "done" "none"
 | 
			
		||||
msg_ok "Completed Successfully!\n"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user