Update disk-passthrough.sh

This commit is contained in:
MacRimi 2025-01-23 21:51:53 +01:00 committed by GitHub
parent 2eb39f176c
commit a802aca8bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -139,8 +139,7 @@ fi
if [ -z "$disco_fisico" ]; then
echo "$(translate "No se pudo determinar el disco físico.")" >&2
# exit 1
return 0
exit 1
fi
msg_ok "$(translate "Disco físico del sistema identificado"): $disco_fisico. $(translate "Este disco no se mostrará.")"
@ -149,8 +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
# exit 1
return 0
exit 1
fi
# Seleccionar VM
@ -158,8 +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
# exit 1
return 0
exit 1
fi
VMID=$(echo "$VMID" | tr -d '"')
@ -167,8 +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
# exit 1
return 0
exit 1
fi
clear
@ -178,8 +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
# exit 1
return 0
exit 1
fi
msg_info "$(translate "Detectando discos disponibles...")"
@ -199,8 +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
# exit 1
return 0
exit 1
fi
# Calcular longitud máxima del contenido
@ -220,8 +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
# exit 1
return 0
exit 1
fi
msg_ok "$(translate "Discos seleccionados correctamente.")"
@ -236,8 +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
# exit 1
return 0
exit 1
fi
msg_ok "$(translate "Tipo de interfaz seleccionado: $INTERFAZ")"