@@ -41,39 +41,37 @@ function msg_ok() {
4141
4242function msg_error() { echo -e " ${RD} ✗ $1 ${CL} " ; }
4343
44+ # This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
45+ # Supported: Proxmox VE 8.0.x – 8.9.x and 9.0 (NOT 9.1+)
4446pve_check () {
45- if ! command -v pveversion > /dev/null 2>&1 ; then
46- msg_error " This script can only be run on a Proxmox VE host."
47- exit 1
48- fi
49-
5047 local PVE_VER
5148 PVE_VER=" $( pveversion | awk -F' /' ' {print $2}' | awk -F' -' ' {print $1}' ) "
5249
53- # Proxmox VE 8.x: allow 8.0 – 8.9
54- if [[ " $PVE_VER " =~ ^9 \. ([0-9]+)( \. [0-9]+) ? $ ]]; then
50+ # Check for Proxmox VE 8.x: allow 8.0– 8.9
51+ if [[ " $PVE_VER " =~ ^8 \. ([0-9]+) ]]; then
5552 local MINOR=" ${BASH_REMATCH[1]} "
56- if (( MINOR != 0 )) ; then
57- msg_error " Unsupported Proxmox VE version: $PVE_VER "
58- msg_error " Supported versions: 8.0 – 8.9 or 9.0.x "
53+ if (( MINOR < 0 || MINOR > 9 )) ; then
54+ msg_error " This version of Proxmox VE is not supported. "
55+ msg_error " Supported: Proxmox VE version 8.0 – 8.9"
5956 exit 1
6057 fi
6158 return 0
6259 fi
6360
64- # Proxmox VE 9.x: allow only 9.0
65- if [[ " $PVE_VER " =~ ^9\. ([0-9]+)$ ]]; then
61+ # Check for Proxmox VE 9.x: allow ONLY 9.0
62+ if [[ " $PVE_VER " =~ ^9\. ([0-9]+) ]]; then
6663 local MINOR=" ${BASH_REMATCH[1]} "
6764 if (( MINOR != 0 )) ; then
68- msg_error " Unsupported Proxmox VE version: $PVE_VER "
69- msg_error " Supported versions: 8.0 – 8.9 or 9.0"
65+ msg_error " This version of Proxmox VE is not yet supported. "
66+ msg_error " Supported: Proxmox VE version 9.0"
7067 exit 1
7168 fi
7269 return 0
7370 fi
7471
75- msg_error " Unsupported Proxmox VE version: $PVE_VER "
76- msg_error " Supported versions: 8.0 – 8.9 or 9.0"
72+ # All other unsupported versions
73+ msg_error " This version of Proxmox VE is not supported."
74+ msg_error " Supported versions: Proxmox VE 8.0 – 8.x or 9.0"
7775 exit 1
7876}
7977
0 commit comments