Update disk-passthrough.sh

This commit is contained in:
MacRimi 2025-02-04 17:08:42 +01:00 committed by GitHub
parent 9f54f18356
commit 4c76dd9cbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,7 @@
# Last Updated: 28/01/2025 # Last Updated: 28/01/2025
# ========================================================== # ==========================================================
# Description: # Description:
# This script allows users to assign physical disks for passthrough to existing # This script allows users to assign physical disks to existing
# Proxmox virtual machines (VMs) through an interactive menu. # Proxmox virtual machines (VMs) through an interactive menu.
# - Detects the system disk and excludes it from selection. # - Detects the system disk and excludes it from selection.
# - Lists all available VMs for the user to choose from. # - Lists all available VMs for the user to choose from.
@ -28,22 +28,19 @@
# Configuration ============================================ # Configuration ============================================
UTILS_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/utils.sh" REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
BASE_DIR="/usr/local/share/proxmenux" BASE_DIR="/usr/local/share/proxmenux"
CACHE_FILE="$BASE_DIR/cache.json" UTILS_FILE="$BASE_DIR/utils.sh"
CONFIG_FILE="$BASE_DIR/config.json"
VENV_PATH="/opt/googletrans-env" VENV_PATH="/opt/googletrans-env"
if [[ -f "$UTILS_FILE" ]]; then if [[ -f "$UTILS_FILE" ]]; then
source "$UTILS_FILE" source "$UTILS_FILE"
fi fi
load_language load_language
initialize_cache initialize_cache
# ========================================================== # ==========================================================
# Function to identify the physical disk where Proxmox is installed # Function to identify the physical disk where Proxmox is installed
get_physical_disk() { get_physical_disk() {
local lv_path=$1 local lv_path=$1
@ -84,7 +81,6 @@ if [ -z "$VM_LIST" ]; then
exit 1 exit 1
fi fi
# Select VM # Select VM
VMID=$(whiptail --title "$(translate "Select VM")" --menu "$(translate "Select the VM to which you want to add disks:")" 15 60 8 $VM_LIST 3>&1 1>&2 2>&3) VMID=$(whiptail --title "$(translate "Select VM")" --menu "$(translate "Select the VM to which you want to add disks:")" 15 60 8 $VM_LIST 3>&1 1>&2 2>&3)
@ -111,7 +107,7 @@ if [ "$VM_STATUS" == "running" ]; then
exit 1 exit 1
fi fi
msg_info2 "$(translate "Detecting available disks...")" msg_info "$(translate "Detecting available disks...")"
# Detect free disks, excluding the system disk and those already assigned to the selected VM # Detect free disks, excluding the system disk and those already assigned to the selected VM
FREE_DISKS=() FREE_DISKS=()
@ -173,7 +169,7 @@ DISKS_ADDED=0
ERROR_MESSAGES="" ERROR_MESSAGES=""
SUCCESS_MESSAGES="" SUCCESS_MESSAGES=""
msg_info2 "$(translate "Processing selected disks...")" msg_info "$(translate "Processing selected disks...")"
for DISK in $SELECTED; do for DISK in $SELECTED; do
DISK=$(echo "$DISK" | tr -d '"') DISK=$(echo "$DISK" | tr -d '"')