mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-04 23:10:16 +00:00
[Diagnostic] Introduced optional lxc install diagnostics via API call (#1801)
* Update build.func * Update build.func * Update build.func * Update build.func * Update build.func * update build.func * update build.func * update build.func * update build.func * update build.func * update build.func * update build.func * update build.func
This commit is contained in:
parent
645972077e
commit
c799e67ea5
291
misc/build.func
291
misc/build.func
@ -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
|
||||||
|
|
||||||
@ -8,7 +9,9 @@ variables() {
|
|||||||
NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
|
NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
|
||||||
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.
|
||||||
@ -143,10 +146,10 @@ pve_check() {
|
|||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# When a node is running tens of containers, it's possible to exceed the kernel's cryptographic key storage allocations.
|
# When a node is running tens of containers, it's possible to exceed the kernel's cryptographic key storage allocations.
|
||||||
# These are tuneable, so verify if the currently deployment is approaching the limits, advise the user on how to tune the limits, and exit the script.
|
# These are tuneable, so verify if the currently deployment is approaching the limits, advise the user on how to tune the limits, and exit the script.
|
||||||
# https://cleveruptime.com/docs/files/proc-key-users | https://docs.kernel.org/security/keys/core.html
|
# https://cleveruptime.com/docs/files/proc-key-users | https://docs.kernel.org/security/keys/core.html
|
||||||
maxkeys_check() {
|
maxkeys_check() {
|
||||||
@ -222,11 +225,11 @@ get_current_ip() {
|
|||||||
# Function to update the IP address in the MOTD file
|
# Function to update the IP address in the MOTD file
|
||||||
update_motd_ip() {
|
update_motd_ip() {
|
||||||
MOTD_FILE="/etc/motd"
|
MOTD_FILE="/etc/motd"
|
||||||
|
|
||||||
if [ -f "$MOTD_FILE" ]; then
|
if [ -f "$MOTD_FILE" ]; then
|
||||||
# Remove existing IP Address lines to prevent duplication
|
# Remove existing IP Address lines to prevent duplication
|
||||||
sed -i '/IP Address:/d' "$MOTD_FILE"
|
sed -i '/IP Address:/d' "$MOTD_FILE"
|
||||||
|
|
||||||
IP=$(get_current_ip)
|
IP=$(get_current_ip)
|
||||||
# Add the new IP address
|
# Add the new IP address
|
||||||
echo -e "${TAB}${NETWORK}${YW} IP Address: ${GN}${IP}${CL}" >> "$MOTD_FILE"
|
echo -e "${TAB}${NETWORK}${YW} IP Address: ${GN}${IP}${CL}" >> "$MOTD_FILE"
|
||||||
@ -359,34 +362,34 @@ exit_script() {
|
|||||||
advanced_settings() {
|
advanced_settings() {
|
||||||
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58
|
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58
|
||||||
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Default distribution for $APP" "Default is: ${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58
|
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Default distribution for $APP" "Default is: ${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58
|
||||||
if [ "$var_os" != "alpine" ]; then
|
if [ "$var_os" != "alpine" ]; then
|
||||||
var_default_os="${var_os}"
|
var_default_os="${var_os}"
|
||||||
var_os=""
|
var_os=""
|
||||||
while [ -z "$var_os" ]; do
|
while [ -z "$var_os" ]; do
|
||||||
if [ "$var_default_os" == "debian" ]; then
|
if [ "$var_default_os" == "debian" ]; then
|
||||||
if var_os=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \
|
if var_os=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \
|
||||||
"debian" "" ON \
|
"debian" "" ON \
|
||||||
"ubuntu" "" OFF \
|
"ubuntu" "" OFF \
|
||||||
3>&1 1>&2 2>&3); then
|
3>&1 1>&2 2>&3); then
|
||||||
if [ -n "$var_os" ]; then
|
if [ -n "$var_os" ]; then
|
||||||
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
|
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
|
||||||
fi
|
|
||||||
else
|
|
||||||
exit_script
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
exit_script
|
||||||
fi
|
fi
|
||||||
if [ "$var_default_os" == "ubuntu" ]; then
|
fi
|
||||||
if var_os=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \
|
if [ "$var_default_os" == "ubuntu" ]; then
|
||||||
"debian" "" OFF \
|
if var_os=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \
|
||||||
"ubuntu" "" ON \
|
"debian" "" OFF \
|
||||||
3>&1 1>&2 2>&3); then
|
"ubuntu" "" ON \
|
||||||
if [ -n "$var_os" ]; then
|
3>&1 1>&2 2>&3); then
|
||||||
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
|
if [ -n "$var_os" ]; then
|
||||||
fi
|
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
|
||||||
else
|
|
||||||
exit_script
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
exit_script
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -394,7 +397,7 @@ advanced_settings() {
|
|||||||
var_default_version="${var_version}"
|
var_default_version="${var_version}"
|
||||||
var_version=""
|
var_version=""
|
||||||
while [ -z "$var_version" ]; do
|
while [ -z "$var_version" ]; do
|
||||||
if [ "$var_default_version" == "11" ]; then
|
if [ "$var_default_version" == "11" ]; then
|
||||||
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \
|
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \
|
||||||
"11" "Bullseye" ON \
|
"11" "Bullseye" ON \
|
||||||
"12" "Bookworm" OFF \
|
"12" "Bookworm" OFF \
|
||||||
@ -425,13 +428,13 @@ advanced_settings() {
|
|||||||
var_default_version="${var_version}"
|
var_default_version="${var_version}"
|
||||||
var_version=""
|
var_version=""
|
||||||
while [ -z "$var_version" ]; do
|
while [ -z "$var_version" ]; do
|
||||||
if [ "$var_default_version" == "20.04" ]; then
|
if [ "$var_default_version" == "20.04" ]; then
|
||||||
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
||||||
"20.04" "Focal" ON \
|
"20.04" "Focal" ON \
|
||||||
"22.04" "Jammy" OFF \
|
"22.04" "Jammy" OFF \
|
||||||
"24.04" "Noble" OFF \
|
"24.04" "Noble" OFF \
|
||||||
"24.10" "Oracular" OFF \
|
"24.10" "Oracular" OFF \
|
||||||
3>&1 1>&2 2>&3); then
|
3>&1 1>&2 2>&3); then
|
||||||
if [ -n "$var_version" ]; then
|
if [ -n "$var_version" ]; then
|
||||||
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
||||||
fi
|
fi
|
||||||
@ -444,7 +447,7 @@ advanced_settings() {
|
|||||||
"22.04" "Jammy" ON \
|
"22.04" "Jammy" ON \
|
||||||
"24.04" "Noble" OFF \
|
"24.04" "Noble" OFF \
|
||||||
"24.10" "Oracular" OFF \
|
"24.10" "Oracular" OFF \
|
||||||
3>&1 1>&2 2>&3); then
|
3>&1 1>&2 2>&3); then
|
||||||
if [ -n "$var_version" ]; then
|
if [ -n "$var_version" ]; then
|
||||||
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
||||||
fi
|
fi
|
||||||
@ -452,25 +455,25 @@ advanced_settings() {
|
|||||||
exit_script
|
exit_script
|
||||||
fi
|
fi
|
||||||
elif [ "$var_default_version" == "24.04" ]; then
|
elif [ "$var_default_version" == "24.04" ]; then
|
||||||
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
||||||
"20.04" "Focal" OFF \
|
"20.04" "Focal" OFF \
|
||||||
"22.04" "Jammy" OFF \
|
"22.04" "Jammy" OFF \
|
||||||
"24.04" "Noble" ON \
|
"24.04" "Noble" ON \
|
||||||
"24.10" "Oracular" OFF \
|
"24.10" "Oracular" OFF \
|
||||||
3>&1 1>&2 2>&3); then
|
3>&1 1>&2 2>&3); then
|
||||||
if [ -n "$var_version" ]; then
|
if [ -n "$var_version" ]; then
|
||||||
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
exit_script
|
exit_script
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
||||||
"20.04" "Focal" OFF \
|
"20.04" "Focal" OFF \
|
||||||
"22.04" "Jammy" OFF \
|
"22.04" "Jammy" OFF \
|
||||||
"24.04" "Noble" OFF \
|
"24.04" "Noble" OFF \
|
||||||
"24.10" "Oracular" ON \
|
"24.10" "Oracular" ON \
|
||||||
3>&1 1>&2 2>&3); then
|
3>&1 1>&2 2>&3); then
|
||||||
if [ -n "$var_version" ]; then
|
if [ -n "$var_version" ]; then
|
||||||
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
|
||||||
fi
|
fi
|
||||||
@ -485,7 +488,7 @@ advanced_settings() {
|
|||||||
CT_DEFAULT_TYPE="${CT_TYPE}"
|
CT_DEFAULT_TYPE="${CT_TYPE}"
|
||||||
CT_TYPE=""
|
CT_TYPE=""
|
||||||
while [ -z "$CT_TYPE" ]; do
|
while [ -z "$CT_TYPE" ]; do
|
||||||
if [ "$CT_DEFAULT_TYPE" == "1" ]; then
|
if [ "$CT_DEFAULT_TYPE" == "1" ]; then
|
||||||
if CT_TYPE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \
|
if CT_TYPE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
@ -550,7 +553,6 @@ advanced_settings() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if CT_ID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then
|
if CT_ID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then
|
||||||
if [ -z "$CT_ID" ]; then
|
if [ -z "$CT_ID" ]; then
|
||||||
CT_ID="$NEXTID"
|
CT_ID="$NEXTID"
|
||||||
@ -741,14 +743,14 @@ advanced_settings() {
|
|||||||
|
|
||||||
if ADV_TAGS=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Custom Tags?[If you remove all, there will be no tags!]" 8 58 ${TAGS} --title "Advanced Tags" 3>&1 1>&2 2>&3); then
|
if ADV_TAGS=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Custom Tags?[If you remove all, there will be no tags!]" 8 58 ${TAGS} --title "Advanced Tags" 3>&1 1>&2 2>&3); then
|
||||||
if [ -n "${ADV_TAGS}" ]; then
|
if [ -n "${ADV_TAGS}" ]; then
|
||||||
ADV_TAGS=$(echo "$ADV_TAGS" | tr -d '[:space:]')
|
ADV_TAGS=$(echo "$ADV_TAGS" | tr -d '[:space:]')
|
||||||
TAGS="${ADV_TAGS}"
|
TAGS="${ADV_TAGS}"
|
||||||
else
|
else
|
||||||
TAGS=";"
|
TAGS=";"
|
||||||
fi
|
fi
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}Tags: ${BGN}$TAGS${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}Tags: ${BGN}$TAGS${CL}"
|
||||||
else
|
else
|
||||||
exit_script
|
exit_script
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$PW" == -password* ]]; then
|
if [[ "$PW" == -password* ]]; then
|
||||||
@ -771,7 +773,7 @@ advanced_settings() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
SSH_AUTHORIZED_KEY=""
|
SSH_AUTHORIZED_KEY=""
|
||||||
fi
|
fi
|
||||||
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
|
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
|
||||||
VERB="yes"
|
VERB="yes"
|
||||||
else
|
else
|
||||||
@ -789,6 +791,116 @@ advanced_settings() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
post_to_api() {
|
||||||
|
local API_URL="http://api.community-scripts.org/upload"
|
||||||
|
local pve_version="not found"
|
||||||
|
pve_version=$(pveversion | awk -F'[/ ]' '{print $2}')
|
||||||
|
|
||||||
|
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",
|
||||||
|
"pve_version": "$pve_version"
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
diagnostics_check(){
|
||||||
|
if ! [ -d "/usr/local/community-scripts" ]; then
|
||||||
|
mkdir -p /usr/local/community-scripts
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f "/usr/local/community-scripts/diagnostics" ]; then
|
||||||
|
if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send Diagnostics of LXC Installation?\n\n(This only transmits data without user data, just RAM, CPU, LXC name, ...)" 10 58); then
|
||||||
|
cat <<EOF>/usr/local/community-scripts/diagnostics
|
||||||
|
DIAGNOSTICS=yes
|
||||||
|
|
||||||
|
#This file is used to store the diagnostics settings for the Community-Scripts API.
|
||||||
|
#https://github.com/community-scripts/ProxmoxVE/discussions/1836
|
||||||
|
#Your diagnostics will be sent to the Community-Scripts API for troubleshooting/statistical purposes.
|
||||||
|
#You can review the data at https://community-scripts.github.io/ProxmoxVE/data
|
||||||
|
#If you do not wish to send diagnostics, please set the variable 'DIAGNOSTICS' to "no" in /usr/local/community-scripts/diagnostics, or use the menue.
|
||||||
|
#This will disable the diagnostics feature.
|
||||||
|
#To send diagnostics, set the variable 'DIAGNOSTICS' to "yes" in /usr/local/community-scripts/diagnostics, or use the menue.
|
||||||
|
#This will enable the diagnostics feature.
|
||||||
|
#The following information will be sent:
|
||||||
|
#"ct_type"
|
||||||
|
#"disk_size"
|
||||||
|
#"core_count"
|
||||||
|
#"ram_size"
|
||||||
|
#"verbose"
|
||||||
|
#"os_type"
|
||||||
|
#"os_version"
|
||||||
|
#"hn"
|
||||||
|
#"disableip6"
|
||||||
|
#"ssh"
|
||||||
|
#"tags"
|
||||||
|
#"nsapp"
|
||||||
|
#"method"
|
||||||
|
#"pve_version"
|
||||||
|
#If you have any concerns, please review the source code at /misc/build.func
|
||||||
|
EOF
|
||||||
|
DIAGNOSTICS="yes"
|
||||||
|
else
|
||||||
|
cat <<EOF >/usr/local/community-scripts/diagnostics
|
||||||
|
DIAGNOSTICS=no
|
||||||
|
|
||||||
|
#This file is used to store the diagnostics settings for the Community-Scripts API.
|
||||||
|
#https://github.com/community-scripts/ProxmoxVE/discussions/1836
|
||||||
|
#Your diagnostics will be sent to the Community-Scripts API for troubleshooting/statistical purposes.
|
||||||
|
#You can review the data at https://community-scripts.github.io/ProxmoxVE/data
|
||||||
|
#If you do not wish to send diagnostics, please set the variable 'DIAGNOSTICS' to "no" in /usr/local/community-scripts/diagnostics, or use the menue.
|
||||||
|
#This will disable the diagnostics feature.
|
||||||
|
#To send diagnostics, set the variable 'DIAGNOSTICS' to "yes" in /usr/local/community-scripts/diagnostics, or use the menue.
|
||||||
|
#This will enable the diagnostics feature.
|
||||||
|
#The following information will be sent:
|
||||||
|
#"ct_type"
|
||||||
|
#"disk_size"
|
||||||
|
#"core_count"
|
||||||
|
#"ram_size"
|
||||||
|
#"verbose"
|
||||||
|
#"os_type"
|
||||||
|
#"os_version"
|
||||||
|
#"hn"
|
||||||
|
#"disableip6"
|
||||||
|
#"ssh"
|
||||||
|
#"tags"
|
||||||
|
#"nsapp"
|
||||||
|
#"method"
|
||||||
|
#"pve_version"
|
||||||
|
#If you have any concerns, please review the source code at /misc/build.func
|
||||||
|
EOF
|
||||||
|
DIAGNOSTICS="no"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
DIAGNOSTICS=$(awk -F '=' '/^DIAGNOSTICS/ {print $2}' /usr/local/community-scripts/diagnostics)
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
install_script() {
|
install_script() {
|
||||||
pve_check
|
pve_check
|
||||||
shell_check
|
shell_check
|
||||||
@ -796,6 +908,7 @@ install_script() {
|
|||||||
arch_check
|
arch_check
|
||||||
ssh_check
|
ssh_check
|
||||||
maxkeys_check
|
maxkeys_check
|
||||||
|
diagnostics_check
|
||||||
|
|
||||||
if systemctl is-active -q ping-instances.service; then
|
if systemctl is-active -q ping-instances.service; then
|
||||||
systemctl -q stop ping-instances.service
|
systemctl -q stop ping-instances.service
|
||||||
@ -804,12 +917,14 @@ install_script() {
|
|||||||
timezone=$(cat /etc/timezone)
|
timezone=$(cat /etc/timezone)
|
||||||
header_info
|
header_info
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
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 5 \
|
||||||
"1" "Default Settings" \
|
"1" "Default Settings" \
|
||||||
"2" "Default Settings (with verbose)" \
|
"2" "Default Settings (with verbose)" \
|
||||||
"3" "Advanced Settings" \
|
"3" "Advanced Settings" \
|
||||||
"4" "Exit" --nocancel --default-item "1" 3>&1 1>&2 2>&3)
|
"4" "Diagnostic Settings" \
|
||||||
|
"5" "Exit" --nocancel --default-item "1" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "${CROSS}${RD} Menu canceled. Exiting.${CL}"
|
echo -e "${CROSS}${RD} Menu canceled. Exiting.${CL}"
|
||||||
@ -817,35 +932,55 @@ install_script() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
1)
|
1)
|
||||||
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"
|
||||||
base_settings "$VERB"
|
METHOD="default"
|
||||||
echo_default
|
base_settings "$VERB"
|
||||||
break
|
echo_default
|
||||||
;;
|
break
|
||||||
2)
|
;;
|
||||||
header_info
|
2)
|
||||||
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}"
|
header_info
|
||||||
VERB="yes"
|
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}"
|
||||||
base_settings "$VERB"
|
VERB="yes"
|
||||||
echo_default
|
METHOD="default"
|
||||||
break
|
base_settings "$VERB"
|
||||||
;;
|
echo_default
|
||||||
3)
|
break
|
||||||
header_info
|
;;
|
||||||
echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}"
|
3)
|
||||||
advanced_settings
|
header_info
|
||||||
break
|
echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}"
|
||||||
;;
|
METHOD="advanced"
|
||||||
4)
|
advanced_settings
|
||||||
echo -e "${CROSS}${RD}Exiting.${CL}"
|
break
|
||||||
exit 0
|
;;
|
||||||
;;
|
4)
|
||||||
*)
|
if [[ $DIAGNOSTICS == "yes" ]]; then
|
||||||
echo -e "${CROSS}${RD}Invalid option, please try again.${CL}"
|
if whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --yesno "Send Diagnostics of LXC Installation?\n\nCurrent setting: ${DIAGNOSTICS}" 10 58 \
|
||||||
|
--yes-button "No" --no-button "Back" ; then
|
||||||
|
DIAGNOSTICS="no"
|
||||||
|
sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=no/' /usr/local/community-scripts/diagnostics
|
||||||
|
whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --msgbox "Diagnostics settings changed to ${DIAGNOSTICS}." 8 58
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --yesno "Send Diagnostics of LXC Installation?\n\nCurrent setting: ${DIAGNOSTICS}" 10 58 \
|
||||||
|
--yes-button "Yes" --no-button "Back" ; then
|
||||||
|
DIAGNOSTICS="yes"
|
||||||
|
sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=yes/' /usr/local/community-scripts/diagnostics
|
||||||
|
whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --msgbox "Diagnostics settings changed to ${DIAGNOSTICS}." 8 58
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
5)
|
||||||
|
echo -e "${CROSS}${RD}Exiting.${CL}"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${CROSS}${RD}Invalid option, please try again.${CL}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -911,7 +1046,7 @@ start() {
|
|||||||
|
|
||||||
# This function collects user settings and integrates all the collected information.
|
# This function collects user settings and integrates all the collected information.
|
||||||
build_container() {
|
build_container() {
|
||||||
# if [ "$VERB" == "yes" ]; then set -x; fi
|
# if [ "$VERB" == "yes" ]; then set -x; fi
|
||||||
|
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="keyctl=1,nesting=1"
|
FEATURES="keyctl=1,nesting=1"
|
||||||
@ -919,6 +1054,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
|
||||||
@ -1012,7 +1150,7 @@ EOF
|
|||||||
msg_ok "Started LXC Container"
|
msg_ok "Started LXC Container"
|
||||||
if [ "$var_os" == "alpine" ]; then
|
if [ "$var_os" == "alpine" ]; then
|
||||||
sleep 3
|
sleep 3
|
||||||
pct exec "$CTID" -- /bin/sh -c 'cat <<EOF >/etc/apk/repositories
|
pct exec "$CTID" -- /bin/sh -c 'cat <<EOF >/etc/apk/repositories
|
||||||
http://dl-cdn.alpinelinux.org/alpine/latest-stable/main
|
http://dl-cdn.alpinelinux.org/alpine/latest-stable/main
|
||||||
http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
|
http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
|
||||||
EOF'
|
EOF'
|
||||||
@ -1027,7 +1165,8 @@ description() {
|
|||||||
IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
|
IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
|
||||||
|
|
||||||
# Generate LXC Description
|
# Generate LXC Description
|
||||||
DESCRIPTION=$(cat <<EOF
|
DESCRIPTION=$(
|
||||||
|
cat <<EOF
|
||||||
<div align='center'>
|
<div align='center'>
|
||||||
<a href='https://Helper-Scripts.com' target='_blank' rel='noopener noreferrer'>
|
<a href='https://Helper-Scripts.com' target='_blank' rel='noopener noreferrer'>
|
||||||
<img src='https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/images/logo-81x112.png' alt='Logo' style='width:81px;height:112px;'/>
|
<img src='https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/images/logo-81x112.png' alt='Logo' style='width:81px;height:112px;'/>
|
||||||
@ -1055,7 +1194,7 @@ description() {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set Description in LXC
|
# Set Description in LXC
|
||||||
pct set "$CTID" -description "$DESCRIPTION"
|
pct set "$CTID" -description "$DESCRIPTION"
|
||||||
|
Loading…
Reference in New Issue
Block a user