bump from ve

This commit is contained in:
CanbiZ 2025-12-08 15:08:20 +01:00
parent cd2036e89a
commit 877ac7875e

View File

@ -1120,38 +1120,49 @@ advanced_settings() {
# Initialize defaults
TAGS="community-script;${var_tags:-}"
local STEP=1
local MAX_STEP=20
local MAX_STEP=28
# Store values for back navigation
local _ct_type="${CT_TYPE:-1}"
# Store values for back navigation - inherit from var_* app defaults
local _ct_type="${var_unprivileged:-1}"
local _pw=""
local _pw_display="Automatic Login"
local _ct_id="$NEXTID"
local _hostname="$NSAPP"
local _disk_size="$var_disk"
local _core_count="$var_cpu"
local _ram_size="$var_ram"
local _bridge="vmbr0"
local _net="dhcp"
local _gate=""
local _ipv6_method="auto"
local _disk_size="${var_disk:-4}"
local _core_count="${var_cpu:-1}"
local _ram_size="${var_ram:-1024}"
local _bridge="${var_brg:-vmbr0}"
local _net="${var_net:-dhcp}"
local _gate="${var_gateway:-}"
local _ipv6_method="${var_ipv6_method:-auto}"
local _ipv6_addr=""
local _ipv6_gate=""
local _apt_cacher_ip=""
local _mtu=""
local _sd=""
local _ns=""
local _mac=""
local _vlan=""
local _apt_cacher="${var_apt_cacher:-no}"
local _apt_cacher_ip="${var_apt_cacher_ip:-}"
local _mtu="${var_mtu:-}"
local _sd="${var_searchdomain:-}"
local _ns="${var_ns:-}"
local _mac="${var_mac:-}"
local _vlan="${var_vlan:-}"
local _tags="$TAGS"
local _enable_fuse="no"
local _enable_fuse="${var_fuse:-no}"
local _enable_tun="${var_tun:-no}"
local _enable_gpu="${var_gpu:-no}"
local _verbose="no"
local _enable_keyctl="0"
local _enable_mknod="0"
local _mount_fs=""
local _protect_ct="no"
local _ct_timezone=""
local _enable_nesting="${var_nesting:-1}"
local _verbose="${var_verbose:-no}"
local _enable_keyctl="${var_keyctl:-0}"
local _enable_mknod="${var_mknod:-0}"
local _mount_fs="${var_mount_fs:-}"
local _protect_ct="${var_protection:-no}"
# Detect host timezone for default (if not set via var_timezone)
local _host_timezone=""
if command -v timedatectl >/dev/null 2>&1; then
_host_timezone=$(timedatectl show --value --property=Timezone 2>/dev/null || echo "")
elif [ -f /etc/timezone ]; then
_host_timezone=$(cat /etc/timezone 2>/dev/null || echo "")
fi
local _ct_timezone="${var_timezone:-$_host_timezone}"
# Helper to show current progress
show_progress() {
@ -1611,14 +1622,17 @@ advanced_settings() {
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 18: FUSE & Verbose Mode
# STEP 18: FUSE Support
# ═══════════════════════════════════════════════════════════════════════════
18)
local fuse_default_flag="--defaultno"
[[ "$_enable_fuse" == "yes" || "$_enable_fuse" == "1" ]] && fuse_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "FUSE SUPPORT" \
--ok-button "Next" --cancel-button "Back" \
--defaultno \
--yesno "\nEnable FUSE support?\n\nRequired for: rclone, mergerfs, AppImage, etc." 12 58; then
$fuse_default_flag \
--yesno "\nEnable FUSE support?\n\nRequired for: rclone, mergerfs, AppImage, etc.\n\n(App default: ${var_fuse:-no})" 14 58; then
_enable_fuse="yes"
else
if [ $? -eq 1 ]; then
@ -1628,30 +1642,69 @@ advanced_settings() {
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 19: TUN/TAP Support
# ═══════════════════════════════════════════════════════════════════════════
19)
local tun_default_flag="--defaultno"
[[ "$_enable_tun" == "yes" || "$_enable_tun" == "1" ]] && tun_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "VERBOSE MODE" \
--defaultno \
--yesno "\nEnable Verbose Mode?\n\nShows detailed output during installation." 12 58; then
_verbose="yes"
--title "TUN/TAP SUPPORT" \
--ok-button "Next" --cancel-button "Back" \
$tun_default_flag \
--yesno "\nEnable TUN/TAP device support?\n\nRequired for: VPN apps (WireGuard, OpenVPN, Tailscale),\nnetwork tunneling, and containerized networking.\n\n(App default: ${var_tun:-no})" 14 62; then
_enable_tun="yes"
else
_verbose="no"
if [ $? -eq 1 ]; then
_enable_tun="no"
else
((STEP--))
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 19: GPU Passthrough
# STEP 20: Nesting Support
# ═══════════════════════════════════════════════════════════════════════════
19)
local gpu_default="OFF"
[[ "$_enable_gpu" == "yes" ]] && gpu_default="ON"
20)
local nesting_default_flag=""
[[ "$_enable_nesting" == "0" || "$_enable_nesting" == "no" ]] && nesting_default_flag="--defaultno"
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "NESTING SUPPORT" \
--ok-button "Next" --cancel-button "Back" \
$nesting_default_flag \
--yesno "\nEnable Nesting?\n\nRequired for: Docker, LXC inside LXC, Podman,\nand other containerization tools.\n\n(App default: ${var_nesting:-1})" 14 58; then
_enable_nesting="1"
else
if [ $? -eq 1 ]; then
_enable_nesting="0"
else
((STEP--))
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 21: GPU Passthrough
# ═══════════════════════════════════════════════════════════════════════════
21)
local gpu_default_flag="--defaultno"
[[ "$_enable_gpu" == "yes" ]] && gpu_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "GPU PASSTHROUGH" \
--ok-button "Next" --cancel-button "Back" \
--defaultno \
--yesno "\nEnable GPU Passthrough?\n\nAutomatically detects and passes through available GPUs\n(Intel/AMD/NVIDIA) for hardware acceleration.\n\nRecommended for: Media servers, AI/ML, Transcoding" 14 62; then
$gpu_default_flag \
--yesno "\nEnable GPU Passthrough?\n\nAutomatically detects and passes through available GPUs\n(Intel/AMD/NVIDIA) for hardware acceleration.\n\nRecommended for: Media servers, AI/ML, Transcoding\n\n(App default: ${var_gpu:-no})" 16 62; then
_enable_gpu="yes"
else
if [ $? -eq 1 ]; then
@ -1665,13 +1718,179 @@ advanced_settings() {
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 20: Confirmation
# STEP 22: Keyctl Support (Docker/systemd)
# ═══════════════════════════════════════════════════════════════════════════
20)
22)
local keyctl_default_flag="--defaultno"
[[ "$_enable_keyctl" == "1" ]] && keyctl_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "KEYCTL SUPPORT" \
--ok-button "Next" --cancel-button "Back" \
$keyctl_default_flag \
--yesno "\nEnable Keyctl support?\n\nRequired for: Docker containers, systemd-networkd,\nand kernel keyring operations.\n\nNote: Automatically enabled for unprivileged containers.\n\n(App default: ${var_keyctl:-0})" 16 62; then
_enable_keyctl="1"
else
if [ $? -eq 1 ]; then
_enable_keyctl="0"
else
((STEP--))
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 23: APT Cacher Proxy
# ═══════════════════════════════════════════════════════════════════════════
23)
local apt_cacher_default_flag="--defaultno"
[[ "$_apt_cacher" == "yes" ]] && apt_cacher_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "APT CACHER PROXY" \
--ok-button "Next" --cancel-button "Back" \
$apt_cacher_default_flag \
--yesno "\nUse APT Cacher-NG proxy?\n\nSpeeds up package downloads by caching them locally.\nRequires apt-cacher-ng running on your network.\n\n(App default: ${var_apt_cacher:-no})" 14 62; then
_apt_cacher="yes"
# Ask for IP if enabled
if result=$(whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "APT CACHER IP" \
--inputbox "\nEnter APT Cacher-NG server IP address:" 10 58 "$_apt_cacher_ip" \
3>&1 1>&2 2>&3); then
_apt_cacher_ip="$result"
fi
else
if [ $? -eq 1 ]; then
_apt_cacher="no"
_apt_cacher_ip=""
else
((STEP--))
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 24: Container Timezone
# ═══════════════════════════════════════════════════════════════════════════
24)
local tz_hint="$_ct_timezone"
[[ -z "$tz_hint" ]] && tz_hint="(empty - will use host timezone)"
if result=$(whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "CONTAINER TIMEZONE" \
--ok-button "Next" --cancel-button "Back" \
--inputbox "\nSet container timezone.\n\nExamples: Europe/Berlin, America/New_York, Asia/Tokyo\n\nHost timezone: ${_host_timezone:-unknown}\n\nLeave empty to inherit from host." 16 62 "$_ct_timezone" \
3>&1 1>&2 2>&3); then
_ct_timezone="$result"
((STEP++))
else
((STEP--))
fi
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 25: Container Protection
# ═══════════════════════════════════════════════════════════════════════════
25)
local protect_default_flag="--defaultno"
[[ "$_protect_ct" == "yes" || "$_protect_ct" == "1" ]] && protect_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "CONTAINER PROTECTION" \
--ok-button "Next" --cancel-button "Back" \
$protect_default_flag \
--yesno "\nEnable Container Protection?\n\nPrevents accidental deletion of this container.\nYou must disable protection before removing.\n\n(App default: ${var_protection:-no})" 14 62; then
_protect_ct="yes"
else
if [ $? -eq 1 ]; then
_protect_ct="no"
else
((STEP--))
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 26: Device Node Creation (mknod)
# ═══════════════════════════════════════════════════════════════════════════
26)
local mknod_default_flag="--defaultno"
[[ "$_enable_mknod" == "1" ]] && mknod_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "DEVICE NODE CREATION" \
--ok-button "Next" --cancel-button "Back" \
$mknod_default_flag \
--yesno "\nAllow device node creation (mknod)?\n\nRequired for: Creating device files inside container.\nExperimental feature (requires kernel 5.3+).\n\n(App default: ${var_mknod:-0})" 14 62; then
_enable_mknod="1"
else
if [ $? -eq 1 ]; then
_enable_mknod="0"
else
((STEP--))
continue
fi
fi
((STEP++))
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 27: Mount Filesystems
# ═══════════════════════════════════════════════════════════════════════════
27)
local mount_hint=""
[[ -n "$_mount_fs" ]] && mount_hint="$_mount_fs" || mount_hint="(none)"
if result=$(whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "MOUNT FILESYSTEMS" \
--ok-button "Next" --cancel-button "Back" \
--inputbox "\nAllow specific filesystem mounts.\n\nComma-separated list: nfs, cifs, fuse, ext4, etc.\nLeave empty for defaults (none).\n\nCurrent: $mount_hint" 14 62 "$_mount_fs" \
3>&1 1>&2 2>&3); then
_mount_fs="$result"
((STEP++))
else
((STEP--))
fi
;;
# ═══════════════════════════════════════════════════════════════════════════
# STEP 28: Verbose Mode & Confirmation
# ═══════════════════════════════════════════════════════════════════════════
28)
local verbose_default_flag="--defaultno"
[[ "$_verbose" == "yes" ]] && verbose_default_flag=""
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "VERBOSE MODE" \
$verbose_default_flag \
--yesno "\nEnable Verbose Mode?\n\nShows detailed output during installation." 12 58; then
_verbose="yes"
else
_verbose="no"
fi
# Build summary
local ct_type_desc="Unprivileged"
[[ "$_ct_type" == "0" ]] && ct_type_desc="Privileged"
local nesting_desc="Disabled"
[[ "$_enable_nesting" == "1" ]] && nesting_desc="Enabled"
local keyctl_desc="Disabled"
[[ "$_enable_keyctl" == "1" ]] && keyctl_desc="Enabled"
local protect_desc="No"
[[ "$_protect_ct" == "yes" || "$_protect_ct" == "1" ]] && protect_desc="Yes"
local tz_display="${_ct_timezone:-Host TZ}"
local apt_display="${_apt_cacher:-no}"
[[ "$_apt_cacher" == "yes" && -n "$_apt_cacher_ip" ]] && apt_display="$_apt_cacher_ip"
local summary="Container Type: $ct_type_desc
Container ID: $_ct_id
Hostname: $_hostname
@ -1686,15 +1905,20 @@ Network:
IPv4: $_net
IPv6: $_ipv6_method
Options:
FUSE: $_enable_fuse
GPU Passthrough: $_enable_gpu
Features:
FUSE: $_enable_fuse | TUN: $_enable_tun
Nesting: $nesting_desc | Keyctl: $keyctl_desc
GPU: $_enable_gpu | Protection: $protect_desc
Advanced:
Timezone: $tz_display
APT Cacher: $apt_display
Verbose: $_verbose"
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "CONFIRM SETTINGS" \
--ok-button "Create LXC" --cancel-button "Back" \
--yesno "$summary\n\nCreate ${APP} LXC with these settings?" 28 58; then
--yesno "$summary\n\nCreate ${APP} LXC with these settings?" 32 62; then
((STEP++))
else
((STEP--))
@ -1721,11 +1945,30 @@ Options:
IPV6_GATE="$_ipv6_gate"
TAGS="$_tags"
ENABLE_FUSE="$_enable_fuse"
ENABLE_TUN="$_enable_tun"
ENABLE_GPU="$_enable_gpu"
ENABLE_NESTING="$_enable_nesting"
ENABLE_KEYCTL="$_enable_keyctl"
ENABLE_MKNOD="$_enable_mknod"
ALLOW_MOUNT_FS="$_mount_fs"
PROTECT_CT="$_protect_ct"
CT_TIMEZONE="$_ct_timezone"
APT_CACHER="$_apt_cacher"
APT_CACHER_IP="$_apt_cacher_ip"
VERBOSE="$_verbose"
# Update var_gpu based on user choice (for is_gpu_app function)
# Update var_* based on user choice (for functions that check these)
var_gpu="$_enable_gpu"
var_fuse="$_enable_fuse"
var_tun="$_enable_tun"
var_nesting="$_enable_nesting"
var_keyctl="$_enable_keyctl"
var_mknod="$_enable_mknod"
var_mount_fs="$_mount_fs"
var_protection="$_protect_ct"
var_timezone="$_ct_timezone"
var_apt_cacher="$_apt_cacher"
var_apt_cacher_ip="$_apt_cacher_ip"
# Format optional values
[[ -n "$_mtu" ]] && MTU=",mtu=$_mtu" || MTU=""
@ -1762,7 +2005,13 @@ Options:
echo -e "${NETWORK}${BOLD}${DGN}IPv4: ${BGN}$NET${CL}"
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}$IPV6_METHOD${CL}"
echo -e "${FUSE}${BOLD}${DGN}FUSE Support: ${BGN}$ENABLE_FUSE${CL}"
echo -e "🎮${BOLD}${DGN} GPU Passthrough: ${BGN}$ENABLE_GPU${CL}"
[[ "$ENABLE_TUN" == "yes" ]] && echo -e "${NETWORK}${BOLD}${DGN}TUN/TAP Support: ${BGN}$ENABLE_TUN${CL}"
echo -e "${CONTAINERTYPE}${BOLD}${DGN}Nesting: ${BGN}$([ "$ENABLE_NESTING" == "1" ] && echo "Enabled" || echo "Disabled")${CL}"
[[ "$ENABLE_KEYCTL" == "1" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Keyctl: ${BGN}Enabled${CL}"
echo -e "${GPU}${BOLD}${DGN}GPU Passthrough: ${BGN}$ENABLE_GPU${CL}"
[[ "$PROTECT_CT" == "yes" || "$PROTECT_CT" == "1" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Protection: ${BGN}Enabled${CL}"
[[ -n "$CT_TIMEZONE" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}Timezone: ${BGN}$CT_TIMEZONE${CL}"
[[ "$APT_CACHER" == "yes" ]] && echo -e "${CONTAINERTYPE}${BOLD}${DGN}APT Cacher: ${BGN}$APT_CACHER_IP${CL}"
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERBOSE${CL}"
echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
}
@ -2431,39 +2680,24 @@ build_container() {
none) ;;
esac
# Build FEATURES string
if [ "$CT_TYPE" == "1" ]; then
FEATURES="keyctl=1,nesting=1"
else
# Build FEATURES string based on container type and user choices
FEATURES=""
# Nesting support (user configurable, default enabled)
if [ "${ENABLE_NESTING:-1}" == "1" ]; then
FEATURES="nesting=1"
fi
if [ "$ENABLE_FUSE" == "yes" ]; then
FEATURES="$FEATURES,fuse=1"
# Keyctl for unprivileged containers (needed for Docker)
if [ "$CT_TYPE" == "1" ]; then
[ -n "$FEATURES" ] && FEATURES="$FEATURES,"
FEATURES="${FEATURES}keyctl=1"
fi
# # Build FEATURES string based on container type and settings
# FEATURES="nesting=1"
# # keyctl: required for Docker in unprivileged containers
# if [ "$CT_TYPE" == "1" ] || [ "${ENABLE_KEYCTL:-0}" == "1" ]; then
# FEATURES="$FEATURES,keyctl=1"
# fi
# # fuse: allow FUSE filesystems
# if [ "$ENABLE_FUSE" == "yes" ]; then
# FEATURES="$FEATURES,fuse=1"
# fi
# # mknod: allow device node creation (kernel 5.3+, experimental)
# if [ "${ENABLE_MKNOD:-0}" == "1" ]; then
# FEATURES="$FEATURES,mknod=1"
# fi
# # mount: allow specific filesystem types
# if [ -n "${MOUNT_FS:-}" ]; then
# FEATURES="$FEATURES,mount=$MOUNT_FS"
# fi
if [ "$ENABLE_FUSE" == "yes" ]; then
[ -n "$FEATURES" ] && FEATURES="$FEATURES,"
FEATURES="${FEATURES}fuse=1"
fi
# NEW IMPLEMENTATION (Fixed): Build PCT_OPTIONS properly
# Key insight: Bash cannot export arrays, so we build the options as a string