Add ipv6
This commit is contained in:
parent
7910bbb880
commit
c4769c0ca9
@ -2,7 +2,7 @@
|
|||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
# Co-Author: MickLesk
|
# Co-Author: MickLesk
|
||||||
# Co-Author: michelroegl-brunner
|
# Co-Author: michelroegl-brunner
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
variables() {
|
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.
|
||||||
@ -14,7 +14,7 @@ variables() {
|
|||||||
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" # generates a random UUID and sets it to the RANDOM_UUID variable.
|
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" # generates a random UUID and sets it to the RANDOM_UUID variable.
|
||||||
}
|
}
|
||||||
|
|
||||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/api.func)
|
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
|
||||||
|
|
||||||
# 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.
|
||||||
color() {
|
color() {
|
||||||
@ -69,7 +69,7 @@ catch_errors() {
|
|||||||
|
|
||||||
# This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message.
|
# This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message.
|
||||||
error_handler() {
|
error_handler() {
|
||||||
source /dev/stdin <<<$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/api.func)
|
source /dev/stdin <<<$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
|
||||||
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"
|
printf "\e[?25h"
|
||||||
local exit_code="$?"
|
local exit_code="$?"
|
||||||
@ -274,7 +274,7 @@ update_motd_ip() {
|
|||||||
# Function to download & save header files
|
# Function to download & save header files
|
||||||
get_header() {
|
get_header() {
|
||||||
local app_name=$(echo ${APP,,} | tr -d ' ')
|
local app_name=$(echo ${APP,,} | tr -d ' ')
|
||||||
local header_url="https://github.com/community-scripts/ProxmoxVED/raw/main/ct/headers/${app_name}"
|
local header_url="https://github.com/community-scripts/ProxmoxVE/raw/main/ct/headers/${app_name}"
|
||||||
local local_header_path="/usr/local/community-scripts/headers/${app_name}"
|
local local_header_path="/usr/local/community-scripts/headers/${app_name}"
|
||||||
|
|
||||||
mkdir -p "/usr/local/community-scripts/headers"
|
mkdir -p "/usr/local/community-scripts/headers"
|
||||||
@ -333,6 +333,7 @@ base_settings() {
|
|||||||
HN=$NSAPP
|
HN=$NSAPP
|
||||||
BRG="vmbr0"
|
BRG="vmbr0"
|
||||||
NET="dhcp"
|
NET="dhcp"
|
||||||
|
IPv6="auto"
|
||||||
GATE=""
|
GATE=""
|
||||||
APT_CACHER=""
|
APT_CACHER=""
|
||||||
APT_CACHER_IP=""
|
APT_CACHER_IP=""
|
||||||
@ -711,7 +712,25 @@ advanced_settings() {
|
|||||||
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then
|
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then
|
||||||
DISABLEIP6="yes"
|
DISABLEIP6="yes"
|
||||||
else
|
else
|
||||||
|
IPv6="auto"
|
||||||
DISABLEIP6="no"
|
DISABLEIP6="no"
|
||||||
|
if IP6=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "IPv6" --inputbox "Enter IPv6 Address (Default SLAAC)" 10 58); then
|
||||||
|
IPv6=$IP6
|
||||||
|
echo -e "${NETWORK}${BOLD}${DGN}IPv6 Address: ${BGN}$IPv6${CL}"
|
||||||
|
if IP6GW=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Enter IPv6 Gateway" 8 58 --title "IPv6 Gateway" 3>&1 1>&2 2>&3); then
|
||||||
|
if [ -z $IP6GW ]; then
|
||||||
|
IP6GW="Default"
|
||||||
|
echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}$IP6GW${CL}"
|
||||||
|
else
|
||||||
|
IPv6GW=",gw6=$IP6GW"
|
||||||
|
echo -e "${GATEWAY}${BOLD}${DGN}IPv6 Gateway: ${BGN}$IP6GW${CL}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit_script
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
IPv6="auto"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo -e "${DISABLEIPV6}${BOLD}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}"
|
echo -e "${DISABLEIPV6}${BOLD}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}"
|
||||||
|
|
||||||
@ -837,9 +856,9 @@ diagnostics_check() {
|
|||||||
DIAGNOSTICS=yes
|
DIAGNOSTICS=yes
|
||||||
|
|
||||||
#This file is used to store the diagnostics settings for the Community-Scripts API.
|
#This file is used to store the diagnostics settings for the Community-Scripts API.
|
||||||
#https://github.com/community-scripts/ProxmoxVED/discussions/1836
|
#https://github.com/community-scripts/ProxmoxVE/discussions/1836
|
||||||
#Your diagnostics will be sent to the Community-Scripts API for troubleshooting/statistical purposes.
|
#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/ProxmoxVED/data
|
#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.
|
#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.
|
#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.
|
#To send diagnostics, set the variable 'DIAGNOSTICS' to "yes" in /usr/local/community-scripts/diagnostics, or use the menue.
|
||||||
@ -864,9 +883,9 @@ EOF
|
|||||||
DIAGNOSTICS=no
|
DIAGNOSTICS=no
|
||||||
|
|
||||||
#This file is used to store the diagnostics settings for the Community-Scripts API.
|
#This file is used to store the diagnostics settings for the Community-Scripts API.
|
||||||
#https://github.com/community-scripts/ProxmoxVED/discussions/1836
|
#https://github.com/community-scripts/ProxmoxVE/discussions/1836
|
||||||
#Your diagnostics will be sent to the Community-Scripts API for troubleshooting/statistical purposes.
|
#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/ProxmoxVED/data
|
#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.
|
#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.
|
#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.
|
#To send diagnostics, set the variable 'DIAGNOSTICS' to "yes" in /usr/local/community-scripts/diagnostics, or use the menue.
|
||||||
@ -1082,9 +1101,9 @@ build_container() {
|
|||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
if [ "$var_os" == "alpine" ]; then
|
if [ "$var_os" == "alpine" ]; then
|
||||||
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/alpine-install.func)"
|
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)"
|
||||||
else
|
else
|
||||||
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/install.func)"
|
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)"
|
||||||
fi
|
fi
|
||||||
export RANDOM_UUID="$RANDOM_UUID"
|
export RANDOM_UUID="$RANDOM_UUID"
|
||||||
export CACHER="$APT_CACHER"
|
export CACHER="$APT_CACHER"
|
||||||
@ -1102,7 +1121,9 @@ build_container() {
|
|||||||
export PCT_OSTYPE="$var_os"
|
export PCT_OSTYPE="$var_os"
|
||||||
export PCT_OSVERSION="$var_version"
|
export PCT_OSVERSION="$var_version"
|
||||||
export PCT_DISK_SIZE="$DISK_SIZE"
|
export PCT_DISK_SIZE="$DISK_SIZE"
|
||||||
export PCT_OPTIONS="
|
export IPv6="$IPv6"
|
||||||
|
if [[ DISABLEIP6 == "yes" ]]; then
|
||||||
|
export PCT_OPTIONS="
|
||||||
-features $FEATURES
|
-features $FEATURES
|
||||||
-hostname $HN
|
-hostname $HN
|
||||||
-tags $TAGS
|
-tags $TAGS
|
||||||
@ -1115,8 +1136,24 @@ build_container() {
|
|||||||
-unprivileged $CT_TYPE
|
-unprivileged $CT_TYPE
|
||||||
$PW
|
$PW
|
||||||
"
|
"
|
||||||
|
else
|
||||||
|
export PCT_OPTIONS="
|
||||||
|
-features $FEATURES
|
||||||
|
-hostname $HN
|
||||||
|
-tags $TAGS
|
||||||
|
$SD
|
||||||
|
$NS
|
||||||
|
-net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN$MTU,ip6=$IPv6$IPv6GW
|
||||||
|
-onboot 1
|
||||||
|
-cores $CORE_COUNT
|
||||||
|
-memory $RAM_SIZE
|
||||||
|
-unprivileged $CT_TYPE
|
||||||
|
$PW
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
# This executes create_lxc.sh and creates the container and .conf file
|
# This executes create_lxc.sh and creates the container and .conf file
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/create_lxc.sh)" || exit $?
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/create_lxc.sh)" || exit $?
|
||||||
|
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
if [ "$CT_TYPE" == "0" ]; then
|
if [ "$CT_TYPE" == "0" ]; then
|
||||||
@ -1178,7 +1215,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
|
|||||||
EOF'
|
EOF'
|
||||||
pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
|
pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
|
||||||
fi
|
fi
|
||||||
lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/$var_install.sh)" || exit $?
|
lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/$var_install.sh)" || exit $?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1191,7 +1228,7 @@ description() {
|
|||||||
cat <<EOF
|
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/ProxmoxVED/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;'/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<h2 style='font-size: 24px; margin: 20px 0;'>${APP} LXC</h2>
|
<h2 style='font-size: 24px; margin: 20px 0;'>${APP} LXC</h2>
|
||||||
@ -1201,18 +1238,18 @@ description() {
|
|||||||
<img src='https://img.shields.io/badge/☕-Buy us a coffee-blue' alt='spend Coffee' />
|
<img src='https://img.shields.io/badge/☕-Buy us a coffee-blue' alt='spend Coffee' />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<span style='margin: 0 10px;'>
|
<span style='margin: 0 10px;'>
|
||||||
<i class="fa fa-github fa-fw" style="color: #f5f5f5;"></i>
|
<i class="fa fa-github fa-fw" style="color: #f5f5f5;"></i>
|
||||||
<a href='https://github.com/community-scripts/ProxmoxVE' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>GitHub</a>
|
<a href='https://github.com/community-scripts/ProxmoxVE' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>GitHub</a>
|
||||||
</span>
|
</span>
|
||||||
<span style='margin: 0 10px;'>
|
<span style='margin: 0 10px;'>
|
||||||
<i class="fa fa-comments fa-fw" style="color: #f5f5f5;"></i>
|
<i class="fa fa-comments fa-fw" style="color: #f5f5f5;"></i>
|
||||||
<a href='https://github.com/community-scripts/ProxmoxVED/discussions' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>Discussions</a>
|
<a href='https://github.com/community-scripts/ProxmoxVE/discussions' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>Discussions</a>
|
||||||
</span>
|
</span>
|
||||||
<span style='margin: 0 10px;'>
|
<span style='margin: 0 10px;'>
|
||||||
<i class="fa fa-exclamation-circle fa-fw" style="color: #f5f5f5;"></i>
|
<i class="fa fa-exclamation-circle fa-fw" style="color: #f5f5f5;"></i>
|
||||||
<a href='https://github.com/community-scripts/ProxmoxVED/issues' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>Issues</a>
|
<a href='https://github.com/community-scripts/ProxmoxVE/issues' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>Issues</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
EOF
|
EOF
|
||||||
@ -1250,7 +1287,7 @@ exit_script() {
|
|||||||
#200 exit codes indicate error in create_lxc.sh
|
#200 exit codes indicate error in create_lxc.sh
|
||||||
#100 exit codes indicate error in install.func
|
#100 exit codes indicate error in install.func
|
||||||
|
|
||||||
if [ $exit_code -ne 0 ]; then
|
if [ $exit_code -ne 0 ]; then
|
||||||
case $exit_code in
|
case $exit_code in
|
||||||
100) post_update_to_api "failed" "100: Unexpected error in create_lxc.sh" ;;
|
100) post_update_to_api "failed" "100: Unexpected error in create_lxc.sh" ;;
|
||||||
101) post_update_to_api "failed" "101: No network connection detected in create_lxc.sh" ;;
|
101) post_update_to_api "failed" "101: No network connection detected in create_lxc.sh" ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user