mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-06 07:49:17 +00:00
Merge acd502cda3
into cecf179b34
This commit is contained in:
commit
dfd922c658
@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2021-2025 tteck
|
# Copyright (c) 2021-2025 tteck
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
# Co-Author: MickLesk
|
# Co-Author: MickLesk
|
||||||
|
# Co-Author: michelroegl-brunner
|
||||||
# License: MIT
|
# License: MIT
|
||||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
@ -9,6 +10,8 @@ variables() {
|
|||||||
var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP.
|
var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP.
|
||||||
INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern.
|
INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern.
|
||||||
PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase
|
PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase
|
||||||
|
DIAGNOSTICS="yes" # sets the DIAGNOSTICS variable to "yes", used for the API call.
|
||||||
|
METHOD="default" # sets the METHOD variable to "default", used for the API call.
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function sets various color variables using ANSI escape codes for formatting text in the terminal.
|
# This function sets various color variables using ANSI escape codes for formatting text in the terminal.
|
||||||
@ -789,6 +792,40 @@ advanced_settings() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
post_to_api() {
|
||||||
|
local API_URL="http://api.community-scripts.org/upload"
|
||||||
|
|
||||||
|
|
||||||
|
JSON_PAYLOAD=$(cat <<EOF
|
||||||
|
{
|
||||||
|
"ct_type": $CT_TYPE,
|
||||||
|
"disk_size": $DISK_SIZE,
|
||||||
|
"core_count": $CORE_COUNT,
|
||||||
|
"ram_size": $RAM_SIZE,
|
||||||
|
"verbose": "$VERBOSE",
|
||||||
|
"os_type": "$var_os",
|
||||||
|
"os_version": "$var_version",
|
||||||
|
"hn": "$HN",
|
||||||
|
"disableip6": "$DISABLEIP6",
|
||||||
|
"ssh": "$SSH",
|
||||||
|
"tags": "$TAGS",
|
||||||
|
"nsapp": "$NSAPP",
|
||||||
|
"method": "$METHOD"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
RESPONSE=$(curl -s -o response.txt -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$JSON_PAYLOAD")
|
||||||
|
|
||||||
|
if [ "$RESPONSE" -ne 201 ] && [ "$RESPONSE" -ne 302 ]; then
|
||||||
|
msg_error "API request failed with HTTP code $RESPONSE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
install_script() {
|
install_script() {
|
||||||
pve_check
|
pve_check
|
||||||
shell_check
|
shell_check
|
||||||
@ -804,6 +841,11 @@ install_script() {
|
|||||||
timezone=$(cat /etc/timezone)
|
timezone=$(cat /etc/timezone)
|
||||||
header_info
|
header_info
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
|
if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send diagnostics to the maintainer? (No User Data!)" 10 58); then
|
||||||
|
DIAGNOSTICS="no"
|
||||||
|
fi
|
||||||
|
|
||||||
CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --menu "Choose an option:" \
|
CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --menu "Choose an option:" \
|
||||||
12 50 4 \
|
12 50 4 \
|
||||||
"1" "Default Settings" \
|
"1" "Default Settings" \
|
||||||
@ -821,6 +863,7 @@ install_script() {
|
|||||||
header_info
|
header_info
|
||||||
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME${CL}"
|
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME${CL}"
|
||||||
VERB="no"
|
VERB="no"
|
||||||
|
METHOD="default"
|
||||||
base_settings "$VERB"
|
base_settings "$VERB"
|
||||||
echo_default
|
echo_default
|
||||||
break
|
break
|
||||||
@ -829,6 +872,7 @@ install_script() {
|
|||||||
header_info
|
header_info
|
||||||
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}"
|
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}"
|
||||||
VERB="yes"
|
VERB="yes"
|
||||||
|
METHOD="default"
|
||||||
base_settings "$VERB"
|
base_settings "$VERB"
|
||||||
echo_default
|
echo_default
|
||||||
break
|
break
|
||||||
@ -836,6 +880,7 @@ install_script() {
|
|||||||
3)
|
3)
|
||||||
header_info
|
header_info
|
||||||
echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}"
|
echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}"
|
||||||
|
METHOD="advanced"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@ -919,6 +964,9 @@ build_container() {
|
|||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $DIAGNOSTICS == "yes" ]]; then
|
||||||
|
post_to_api
|
||||||
|
fi
|
||||||
|
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
|
Loading…
Reference in New Issue
Block a user