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 if [ -z "$disco_fisico" ]; then
echo "$(translate "No se pudo determinar el disco físico.")" >&2 echo "$(translate "No se pudo determinar el disco físico.")" >&2
# exit 1 exit 1
return 0
fi fi
msg_ok "$(translate "Disco físico del sistema identificado"): $disco_fisico. $(translate "Este disco no se mostrará.")" 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}') VM_LIST=$(qm list | awk 'NR>1 {print $1, $2}')
if [ -z "$VM_LIST" ]; then if [ -z "$VM_LIST" ]; then
whiptail --title "$(translate "Error")" --msgbox "$(translate "No hay VMs disponibles en el sistema.")" 8 40 whiptail --title "$(translate "Error")" --msgbox "$(translate "No hay VMs disponibles en el sistema.")" 8 40
# exit 1 exit 1
return 0
fi fi
# Seleccionar VM # Seleccionar VM
@ -158,8 +156,7 @@ VMID=$(whiptail --title "$(translate "Seleccionar VM")" --menu "$(translate "Sel
if [ -z "$VMID" ]; then if [ -z "$VMID" ]; then
whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionó ninguna VM.")" 8 40 whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionó ninguna VM.")" 8 40
# exit 1 exit 1
return 0
fi fi
VMID=$(echo "$VMID" | tr -d '"') VMID=$(echo "$VMID" | tr -d '"')
@ -167,8 +164,7 @@ VMID=$(echo "$VMID" | tr -d '"')
# Verificar que VMID es un número # Verificar que VMID es un número
if ! [[ "$VMID" =~ ^[0-9]+$ ]]; then if ! [[ "$VMID" =~ ^[0-9]+$ ]]; then
whiptail --title "$(translate "Error")" --msgbox "$(translate "El ID de VM seleccionado no es válido.")" 8 40 whiptail --title "$(translate "Error")" --msgbox "$(translate "El ID de VM seleccionado no es válido.")" 8 40
# exit 1 exit 1
return 0
fi fi
clear clear
@ -178,8 +174,7 @@ msg_ok "$(translate "VM seleccionada correctamente.")"
VM_STATUS=$(qm status "$VMID" | awk '{print $2}') VM_STATUS=$(qm status "$VMID" | awk '{print $2}')
if [ "$VM_STATUS" == "running" ]; then if [ "$VM_STATUS" == "running" ]; then
whiptail --title "$(translate "Advertencia")" --msgbox "$(translate "La VM está encendida. Apágala antes de añadir discos.")" 12 60 whiptail --title "$(translate "Advertencia")" --msgbox "$(translate "La VM está encendida. Apágala antes de añadir discos.")" 12 60
# exit 1 exit 1
return 0
fi fi
msg_info "$(translate "Detectando discos disponibles...")" msg_info "$(translate "Detectando discos disponibles...")"
@ -199,8 +194,7 @@ msg_ok "$(translate "Discos disponibles detectados.")"
if [ "${#DISCOS_LIBRES[@]}" -eq 0 ]; then if [ "${#DISCOS_LIBRES[@]}" -eq 0 ]; then
whiptail --title "$(translate "Error")" --msgbox "$(translate "No hay discos disponibles para esta VM.")" 8 40 whiptail --title "$(translate "Error")" --msgbox "$(translate "No hay discos disponibles para esta VM.")" 8 40
clear clear
# exit 1 exit 1
return 0
fi fi
# Calcular longitud máxima del contenido # Calcular longitud máxima del contenido
@ -220,8 +214,7 @@ SELECCIONADOS=$(whiptail --title "$(translate "Seleccionar Discos")" --checklist
if [ -z "$SELECCIONADOS" ]; then if [ -z "$SELECCIONADOS" ]; then
whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionaron discos.")" 10 $TOTAL_WIDTH whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionaron discos.")" 10 $TOTAL_WIDTH
clear clear
# exit 1 exit 1
return 0
fi fi
msg_ok "$(translate "Discos seleccionados correctamente.")" msg_ok "$(translate "Discos seleccionados correctamente.")"
@ -236,8 +229,7 @@ INTERFAZ=$(whiptail --title "$(translate "Tipo de Interfaz")" --menu "$(translat
if [ -z "$INTERFAZ" ]; then if [ -z "$INTERFAZ" ]; then
whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionó un tipo de interfaz para los discos.")" 8 40 whiptail --title "$(translate "Error")" --msgbox "$(translate "No se seleccionó un tipo de interfaz para los discos.")" 8 40
clear clear
# exit 1 exit 1
return 0
fi fi
msg_ok "$(translate "Tipo de interfaz seleccionado: $INTERFAZ")" msg_ok "$(translate "Tipo de interfaz seleccionado: $INTERFAZ")"