2025-05-01 23:35:19 +02:00
#!/usr/bin/env bash
2025-05-07 23:50:20 +02:00
# ==========================================================
# ProxMenuX - Virtual Machine Creator Script
# ==========================================================
# Author : MacRimi
# Copyright : (c) 2024 MacRimi
2026-01-19 17:15:00 +01:00
# License : (GPL-3.0) (https://github.com/MacRimi/ProxMenux/blob/main/LICENSE)
2025-05-07 23:50:20 +02:00
# Version : 1.0
2026-04-05 11:24:08 +02:00
# Last Updated: 04/04/2026
2025-05-07 23:50:20 +02:00
# ==========================================================
# Description:
# This script is part of the central ProxMenux VM creation module. It allows users
# to create virtual machines (VMs) in Proxmox VE using either default or advanced
# configurations, streamlining the deployment of Linux, Windows, and other systems.
#
# Key features:
# - Supports both virtual disk creation and physical disk passthrough.
# - Automates CPU, RAM, BIOS, network and storage configuration.
# - Provides a user-friendly menu to select OS type, ISO image and disk interface.
# - Automatically generates a detailed and styled HTML description for each VM.
#
# All operations are designed to simplify and accelerate VM creation in a
# consistent and maintainable way, using ProxMenux standards.
# ==========================================================
2025-05-01 23:35:19 +02:00
2026-04-05 11:24:08 +02:00
SCRIPT_DIR = " $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd ) "
LOCAL_SCRIPTS_LOCAL = " $( cd " $SCRIPT_DIR /.. " && pwd ) "
LOCAL_SCRIPTS_DEFAULT = "/usr/local/share/proxmenux/scripts"
LOCAL_SCRIPTS = " $LOCAL_SCRIPTS_DEFAULT "
2025-05-01 23:35:19 +02:00
BASE_DIR = "/usr/local/share/proxmenux"
2026-04-05 11:24:08 +02:00
UTILS_FILE = " $LOCAL_SCRIPTS /utils.sh "
2025-05-01 23:35:19 +02:00
VENV_PATH = "/opt/googletrans-env"
2026-04-05 11:24:08 +02:00
if [ [ -f " $LOCAL_SCRIPTS_LOCAL /utils.sh " ] ] ; then
LOCAL_SCRIPTS = " $LOCAL_SCRIPTS_LOCAL "
UTILS_FILE = " $LOCAL_SCRIPTS /utils.sh "
elif [ [ ! -f " $UTILS_FILE " ] ] ; then
UTILS_FILE = " $BASE_DIR /utils.sh "
fi
2025-05-01 23:35:19 +02:00
[ [ -f " $UTILS_FILE " ] ] && source " $UTILS_FILE "
load_language
initialize_cache
ISO_DIR = "/var/lib/vz/template/iso"
mkdir -p " $ISO_DIR "
2026-04-05 11:24:08 +02:00
function _has_curl( ) {
command -v curl >/dev/null 2>& 1
}
function _latest_version_from_lines( ) {
awk 'NF' | sort -V | tail -n 1
}
function resolve_truenas_scale_iso( ) {
local default_ver = "25.10.2.1"
local base_url = "https://download.sys.truenas.net/TrueNAS-SCALE-Goldeye"
local detected_ver = ""
if _has_curl; then
detected_ver = $(
curl -fsSL " ${ base_url } / " 2>/dev/null \
| grep -Eo '>[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?/' \
| tr -d '>/' \
| _latest_version_from_lines
)
fi
[ [ -z " $detected_ver " ] ] && detected_ver = " $default_ver "
ISO_NAME = " TrueNAS SCALE ${ detected_ver } (Goldeye) "
ISO_FILE = " TrueNAS-SCALE- ${ detected_ver } .iso "
ISO_URL = " ${ base_url } / ${ detected_ver } / ${ ISO_FILE } "
ISO_PATH = " $ISO_DIR / $ISO_FILE "
HN = "TrueNAS-Scale"
}
function resolve_truenas_core_iso( ) {
local default_file = "TrueNAS-13.3-U1.2.iso"
local detected_file = ""
local base_url = "https://download.freenas.org/13.3/STABLE/latest/x64"
if _has_curl; then
detected_file = $(
curl -fsSL " ${ base_url } / " 2>/dev/null \
| grep -Eo 'TrueNAS-13\.3-[^"]+\.iso' \
| head -n 1
)
fi
[ [ -z " $detected_file " ] ] && detected_file = " $default_file "
ISO_NAME = "TrueNAS CORE 13.3"
ISO_FILE = " $detected_file "
ISO_URL = " ${ base_url } / ${ ISO_FILE } "
ISO_PATH = " $ISO_DIR / $ISO_FILE "
HN = "TrueNAS-Core"
}
function resolve_omv_iso( ) {
local default_ver = "8.1.1"
local detected_ver = ""
if _has_curl; then
detected_ver = $(
curl -fsSL "https://sourceforge.net/projects/openmediavault/files/iso/" 2>/dev/null \
| grep -Eo '/projects/openmediavault/files/iso/[0-9]+\.[0-9]+\.[0-9]+/' \
| sed -E 's|.*/iso/([0-9]+\.[0-9]+\.[0-9]+)/$|\1|' \
| _latest_version_from_lines
)
fi
[ [ -z " $detected_ver " ] ] && detected_ver = " $default_ver "
ISO_NAME = " OpenMediaVault ${ detected_ver } "
ISO_FILE = " openmediavault_ ${ detected_ver } -amd64.iso "
ISO_URL = " https://sourceforge.net/projects/openmediavault/files/iso/ ${ detected_ver } / ${ ISO_FILE } /download "
ISO_PATH = " $ISO_DIR / $ISO_FILE "
HN = "OpenMediaVault"
}
function resolve_xigmanas_iso( ) {
local default_train = "14.3.0.5"
local default_build = "14.3.0.5.10566"
local detected_train = ""
local detected_build = ""
if _has_curl; then
detected_train = $(
curl -fsSL "https://sourceforge.net/projects/xigmanas/files/" 2>/dev/null \
| grep -Eo '/projects/xigmanas/files/XigmaNAS-[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/' \
| sed -E 's|.*/XigmaNAS-([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/$|\1|' \
| _latest_version_from_lines
)
fi
[ [ -z " $detected_train " ] ] && detected_train = " $default_train "
if _has_curl; then
detected_build = $(
curl -fsSL " https://sourceforge.net/projects/xigmanas/files/XigmaNAS- ${ detected_train } / " 2>/dev/null \
| grep -Eo " /projects/xigmanas/files/XigmaNAS- ${ detected_train } /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ " \
| sed -E " s|.*/XigmaNAS- ${ detected_train } /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/ $|\\1| " \
| _latest_version_from_lines
)
fi
[ [ -z " $detected_build " ] ] && detected_build = " $default_build "
ISO_NAME = " XigmaNAS- ${ detected_train } "
ISO_FILE = " XigmaNAS-x64-LiveCD- ${ detected_build } .iso "
ISO_URL = " https://sourceforge.net/projects/xigmanas/files/XigmaNAS- ${ detected_train } / ${ detected_build } / ${ ISO_FILE } /download "
ISO_PATH = " $ISO_DIR / $ISO_FILE "
HN = "XigmaNAS"
}
function resolve_rockstor_iso( ) {
local default_file = "Rockstor-Leap15.6-generic.x86_64-5.0.15-0.install.iso"
local detected_file = ""
local base_url = "https://rockstor.com/downloads/installer/leap/15.6/x86_64"
if _has_curl; then
detected_file = $(
curl -fsSL " ${ base_url } / " 2>/dev/null \
| grep -Eo 'Rockstor-Leap15\.6-generic\.x86_64-[0-9]+\.[0-9]+\.[0-9]+-[0-9]+\.install\.iso' \
| _latest_version_from_lines
)
fi
[ [ -z " $detected_file " ] ] && detected_file = " $default_file "
ISO_NAME = "Rockstor"
ISO_FILE = " $detected_file "
ISO_URL = " ${ base_url } / ${ ISO_FILE } "
ISO_PATH = " $ISO_DIR / $ISO_FILE "
HN = "Rockstor"
}
2025-05-01 23:35:19 +02:00
function select_nas_iso( ) {
local NAS_OPTIONS = (
2025-05-07 21:44:55 +02:00
"1" "Synology DSM VM (Loader Linux-based)"
2025-12-08 22:52:34 +01:00
"2" "TrueNAS SCALE VM (Goldeye)"
2025-05-07 21:44:55 +02:00
"3" "TrueNAS CORE VM (FreeBSD based)"
"4" "OpenMediaVault VM (Debian based)"
2025-06-29 15:40:36 +02:00
"5" "XigmaNAS VM (FreeBSD based)"
"6" "Rockstor VM (openSUSE based)"
2025-08-21 18:05:45 +02:00
"7" "ZimaOS VM (Proxmox-zimaos)"
2025-06-29 15:40:36 +02:00
"8" "Umbrel OS VM (Helper Scripts)"
"9" " $( translate "Return to Main Menu" ) "
2025-05-01 23:35:19 +02:00
)
local NAS_TYPE
NAS_TYPE = $( dialog --backtitle "ProxMenux" \
--title " $( translate "NAS Systems" ) " \
2025-08-21 18:22:57 +02:00
--menu " \n $( translate "Select the NAS system to install:" ) " 20 70 10 \
2025-05-01 23:35:19 +02:00
" ${ NAS_OPTIONS [@] } " 3>& 1 1>& 2 2>& 3)
2025-05-07 21:42:50 +02:00
2025-05-01 23:35:19 +02:00
[ [ $? -ne 0 ] ] && return 1
case " $NAS_TYPE " in
1)
2025-11-03 02:08:36 +00:00
bash " $LOCAL_SCRIPTS /vm/synology.sh "
2025-05-01 23:35:19 +02:00
msg_success " $( translate "Press Enter to return to menu..." ) "
read -r
return 1
; ;
2)
2026-04-05 11:24:08 +02:00
resolve_truenas_scale_iso
2025-05-01 23:35:19 +02:00
; ;
3)
2026-04-05 11:24:08 +02:00
resolve_truenas_core_iso
2025-05-01 23:35:19 +02:00
; ;
4)
2026-04-05 11:24:08 +02:00
resolve_omv_iso
2025-05-01 23:35:19 +02:00
; ;
5)
2026-04-05 11:24:08 +02:00
resolve_xigmanas_iso
2025-06-29 15:40:36 +02:00
; ;
6)
2026-04-05 11:24:08 +02:00
resolve_rockstor_iso
2025-05-01 23:35:19 +02:00
; ;
2025-06-29 15:40:36 +02:00
7)
2025-11-03 02:08:36 +00:00
bash " $LOCAL_SCRIPTS /vm/zimaos.sh "
2025-05-01 23:35:19 +02:00
msg_success " $( translate "Press Enter to return to menu..." ) "
read -r
return 1
; ;
2025-06-29 15:40:36 +02:00
8)
2025-06-29 13:53:10 +02:00
HN = "Umbrel OS"
bash -c " $( wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/vm/umbrel-os-vm.sh) "
echo -e
2025-06-29 15:02:13 +02:00
echo -e " ${ TAB } $( translate "Default Login Credentials:" ) "
echo -e " ${ TAB } Username: umbrel "
echo -e " ${ TAB } Password: umbrel "
echo -e " ${ TAB } $( translate "After logging in, run: ip a to obtain the IP address.\nThen, enter that IP address in your web browser like this:\n http://IP_ADDRESS\n\nThis will open the Umbral OS dashboard." ) "
2025-06-29 13:53:10 +02:00
echo -e
msg_success " $( translate "Press Enter to return to menu..." ) "
read -r
whiptail --title "Proxmox VE - Umbrel OS" \
--msgbox " $( translate "Umbrel OS installer script by Helper Scripts\n\nVisit the GitHub repo to learn more, contribute, or support the project:\n\nhttps://community-scripts.github.io/ProxmoxVE/scripts?id=umbrel-os-vm" ) " 15 70
return 1
; ;
2025-06-29 15:40:36 +02:00
9)
2025-05-01 23:35:19 +02:00
return 1
; ;
esac
export ISO_NAME ISO_URL ISO_FILE ISO_PATH HN
return 0
}