From c25f20ab517be535d3623804da594aecdd45af66 Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:57:46 +0100 Subject: [PATCH] Update disk-passthrough.sh --- scripts/disk-passthrough.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/disk-passthrough.sh b/scripts/disk-passthrough.sh index 6d67457..71f0b1b 100644 --- a/scripts/disk-passthrough.sh +++ b/scripts/disk-passthrough.sh @@ -148,7 +148,7 @@ msg_ok "$(translate "Disco físico del sistema identificado"): $disco_fisico. $( VM_LIST=$(qm list | awk 'NR>1 {print $1, $2}') if [ -z "$VM_LIST" ]; then whiptail --title "$(translate "Error")" --msgbox "$(translate "No hay VMs disponibles en el sistema.")" 8 40 - return + exit 1 fi # Seleccionar VM @@ -156,7 +156,7 @@ VMID=$(whiptail --title "$(translate "Seleccionar VM")" --menu "$(translate "Sel if [ -z "$VMID" ]; then whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionó ninguna VM.")" 8 40 - return + exit 1 fi VMID=$(echo "$VMID" | tr -d '"') @@ -164,7 +164,7 @@ VMID=$(echo "$VMID" | tr -d '"') # Verificar que VMID es un número if ! [[ "$VMID" =~ ^[0-9]+$ ]]; then whiptail --title "$(translate "Error")" --msgbox "$(translate "El ID de VM seleccionado no es válido.")" 8 40 - return + exit 1 fi clear @@ -174,7 +174,7 @@ msg_ok "$(translate "VM seleccionada correctamente.")" VM_STATUS=$(qm status "$VMID" | awk '{print $2}') if [ "$VM_STATUS" == "running" ]; then whiptail --title "$(translate "Advertencia")" --msgbox "$(translate "La VM está encendida. Apágala antes de añadir discos.")" 12 60 - return + exit 1 fi msg_info "$(translate "Detectando discos disponibles...")" @@ -194,7 +194,7 @@ msg_ok "$(translate "Discos disponibles detectados.")" if [ "${#DISCOS_LIBRES[@]}" -eq 0 ]; then whiptail --title "$(translate "Error")" --msgbox "$(translate "No hay discos disponibles para esta VM.")" 8 40 clear - return + exit 1 fi # Calcular longitud máxima del contenido @@ -214,7 +214,7 @@ SELECCIONADOS=$(whiptail --title "$(translate "Seleccionar Discos")" --checklist if [ -z "$SELECCIONADOS" ]; then whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionaron discos.")" 10 $TOTAL_WIDTH clear - return + exit 1 fi msg_ok "$(translate "Discos seleccionados correctamente.")" @@ -229,7 +229,7 @@ INTERFAZ=$(whiptail --title "$(translate "Tipo de Interfaz")" --menu "$(translat if [ -z "$INTERFAZ" ]; then whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionó un tipo de interfaz para los discos.")" 8 40 clear - return + exit 1 fi msg_ok "$(translate "Tipo de interfaz seleccionado: $INTERFAZ")" @@ -311,3 +311,5 @@ else fi clear +exit 0 +