This commit is contained in:
CanbiZ 2025-06-24 13:00:55 +02:00
parent e191f3d00b
commit b0c1bfe9a7

View File

@ -197,6 +197,8 @@ base_settings() {
HN=$NSAPP HN=$NSAPP
BRG="vmbr0" BRG="vmbr0"
NET="dhcp" NET="dhcp"
IPV6_METHOD="slaac"
IPV6_STATIC=""
GATE="" GATE=""
APT_CACHER="" APT_CACHER=""
APT_CACHER_IP="" APT_CACHER_IP=""
@ -350,8 +352,7 @@ advanced_settings() {
if [ "$CT_TYPE" -eq 0 ]; then if [ "$CT_TYPE" -eq 0 ]; then
CT_TYPE_DESC="Privileged" CT_TYPE_DESC="Privileged"
fi fi
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os | ${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}"
echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}"
fi fi
else else
@ -572,6 +573,72 @@ advanced_settings() {
echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}" echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}"
fi fi
# IPv6 Address Management selection
while true; do
IPV6_METHOD=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --menu \
"Select IPv6 Address Management Type:" 15 58 4 \
"slaac" "SLAAC (recommended, default)" \
"dhcp" "DHCPv6" \
"static" "Static (manual entry)" \
"none" "Disabled" \
--default-item "slaac" 3>&1 1>&2 2>&3)
[ $? -ne 0 ] && exit_script
case "$IPV6_METHOD" in
slaac)
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}SLAAC (automatic)${CL}"
IPV6_ADDR=""
IPV6_GATE=""
break
;;
dhcp)
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}DHCPv6${CL}"
IPV6_ADDR="dhcp"
IPV6_GATE=""
break
;;
static)
# Ask for static IPv6 address (CIDR notation, e.g., 2001:db8::1234/64)
while true; do
IPV6_ADDR=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox \
"Set a static IPv6 CIDR address (e.g., 2001:db8::1234/64)" 8 58 "" \
--title "IPv6 STATIC ADDRESS" 3>&1 1>&2 2>&3) || exit_script
if [[ "$IPV6_ADDR" =~ ^([0-9a-fA-F:]+:+)+[0-9a-fA-F]+(/[0-9]{1,3})$ ]]; then
echo -e "${NETWORK}${BOLD}${DGN}IPv6 Address: ${BGN}$IPV6_ADDR${CL}"
break
else
whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox \
"$IPV6_ADDR is an invalid IPv6 CIDR address. Please enter a valid IPv6 CIDR address (e.g., 2001:db8::1234/64)" 8 58
fi
done
# Optional: ask for IPv6 gateway for static config
while true; do
IPV6_GATE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox \
"Enter IPv6 gateway address (optional, leave blank for none)" 8 58 "" --title "IPv6 GATEWAY" 3>&1 1>&2 2>&3)
if [ -z "$IPV6_GATE" ]; then
IPV6_GATE=""
break
elif [[ "$IPV6_GATE" =~ ^([0-9a-fA-F:]+:+)+[0-9a-fA-F]+$ ]]; then
break
else
whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox \
"Invalid IPv6 gateway format." 8 58
fi
done
break
;;
none)
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}Disabled${CL}"
IPV6_ADDR="none"
IPV6_GATE=""
break
;;
*)
exit_script
;;
esac
done
if [ "$var_os" == "alpine" ]; then if [ "$var_os" == "alpine" ]; then
APT_CACHER="" APT_CACHER=""
APT_CACHER_IP="" APT_CACHER_IP=""
@ -951,6 +1018,17 @@ start() {
build_container() { build_container() {
# if [ "$VERBOSE" == "yes" ]; then set -x; fi # if [ "$VERBOSE" == "yes" ]; then set -x; fi
NET_STRING="-net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN$MTU"
case "$IPV6_METHOD" in
slaac) NET_STRING="$NET_STRING,ip6=slaac" ;;
dhcp) NET_STRING="$NET_STRING,ip6=dhcp" ;;
static)
NET_STRING="$NET_STRING,ip6=$IPV6_ADDR"
[ -n "$IPV6_GATE" ] && NET_STRING="$NET_STRING,gw6=$IPV6_GATE"
;;
none) NET_STRING="$NET_STRING,ip6=none" ;;
esac
if [ "$CT_TYPE" == "1" ]; then if [ "$CT_TYPE" == "1" ]; then
FEATURES="keyctl=1,nesting=1" FEATURES="keyctl=1,nesting=1"
else else
@ -992,18 +1070,18 @@ build_container() {
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 PCT_OPTIONS="
-features $FEATURES -features $FEATURES
-hostname $HN -hostname $HN
-tags $TAGS -tags $TAGS
$SD $SD
$NS $NS
-net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN$MTU $NET_STRING
-onboot 1 -onboot 1
-cores $CORE_COUNT -cores $CORE_COUNT
-memory $RAM_SIZE -memory $RAM_SIZE
-unprivileged $CT_TYPE -unprivileged $CT_TYPE
$PW $PW
" "
# This executes create_lxc.sh and creates the container and .conf file # This executes create_lxc.sh and creates the container and .conf file
CREATE_CMD="bash -c \"\$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/create_lxc.sh)\"" CREATE_CMD="bash -c \"\$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/create_lxc.sh)\""
eval "$CREATE_CMD" eval "$CREATE_CMD"