Update ubuntu2410-vm.sh

This commit is contained in:
CanbiZ 2025-06-16 12:05:58 +02:00
parent 6aea0acd45
commit d44263d597

View File

@ -506,13 +506,16 @@ function advanced_settings() {
fi fi
} }
function has_env_overrides() {
env | grep -qE "^var_(bridge|cpu|cpu_type|disk|disk_cache|hostname|mac|machine|mtu|ram|start_vm|vlan|vmid)="
}
function start_script() { function start_script() {
header_info header_info
init_settings init_settings
if [[ -n "${var_bridge}${var_cpu}${var_cpu_type}${var_disk}${var_disk_cache}${var_hostname}${var_mac}${var_mtu}${var_ram}${var_start_vm}${var_vlan}${var_vmid}" ]]; then if has_env_overrides; then
echo -e "${ADVANCED}${BOLD}${BL}Using Environment Variable Overrides${CL}" echo -e "${ADVANCED}${BOLD}${BL}Using Environment Variable Overrides${CL}"
METHOD="env" METHOD="env"
validate_env_settings
apply_env_overrides apply_env_overrides
elif (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then elif (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings${CL}" echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings${CL}"
@ -592,7 +595,9 @@ done
msg_info "Creating a $APP" msg_info "Creating a $APP"
qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \
-name $HN -tags "community-script;ubuntu" -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci -name $HN -tags "community-script;ubuntu" -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci
pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null if [[ "$STORAGE_TYPE" != "lvmthin" ]]; then
pvesm alloc $STORAGE $VMID $DISK0 4M >/dev/null
fi
qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null
qm set $VMID \ qm set $VMID \
-efidisk0 ${DISK0_REF}${FORMAT} \ -efidisk0 ${DISK0_REF}${FORMAT} \