Compare commits

...

4 Commits

Author SHA1 Message Date
Michel Roegl-Brunner
acd502cda3 update build.func 2025-01-28 14:58:03 +01:00
Michel Roegl-Brunner
2d43fde119 update build.func 2025-01-28 14:56:18 +01:00
Michel Roegl-Brunner
64acc43716 Merge branch 'api' of https://github.com/community-scripts/ProxmoxVE into api 2025-01-28 10:41:14 +01:00
Michel Roegl-Brunner
08286bc999 Update build.func 2025-01-28 10:40:43 +01:00

View File

@ -10,7 +10,8 @@ variables() {
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.
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.
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.
@ -832,18 +833,21 @@ post_to_api() {
"disableip6": "$DISABLEIP6",
"ssh": "$SSH",
"tags": "$TAGS",
"nsapp": "$NSAPP"
"nsapp": "$NSAPP",
"method": "$METHOD"
}
EOF
)
RESPONSE=$(curl -s -o response.txt -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
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() {
@ -883,6 +887,7 @@ install_script() {
header_info
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME${CL}"
VERB="no"
METHOD="default"
base_settings "$VERB"
echo_default
break
@ -891,6 +896,7 @@ install_script() {
header_info
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}"
VERB="yes"
METHOD="default"
base_settings "$VERB"
echo_default
break
@ -898,6 +904,7 @@ install_script() {
3)
header_info
echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}"
METHOD="advanced"
advanced_settings
break
;;