mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 04:06:54 +00:00
Update menu.sh
This commit is contained in:
parent
86d5b529bc
commit
21ee53af26
57
menu.sh
57
menu.sh
@ -14,6 +14,22 @@ msg_info() { echo -e " ${YW}[INFO] $1${CL}"; }
|
|||||||
msg_ok() { echo -e " ${GN}[OK] $1${CL}"; }
|
msg_ok() { echo -e " ${GN}[OK] $1${CL}"; }
|
||||||
msg_error() { echo -e " ${RD}[ERROR] $1${CL}"; }
|
msg_error() { echo -e " ${RD}[ERROR] $1${CL}"; }
|
||||||
|
|
||||||
|
# Detectar si se está ejecutando en la consola física de Proxmox
|
||||||
|
is_physical_console() {
|
||||||
|
if [ "$(tty)" = "/dev/tty1" ] || [ "$(tty)" = "/dev/tty2" ] || [ "$(tty)" = "/dev/tty3" ]; then
|
||||||
|
return 0 # Es consola física
|
||||||
|
else
|
||||||
|
return 1 # No es consola física
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determinar si se debe usar whiptail
|
||||||
|
if is_physical_console; then
|
||||||
|
USE_WHIPTAIL=false
|
||||||
|
else
|
||||||
|
USE_WHIPTAIL=true
|
||||||
|
fi
|
||||||
|
|
||||||
# Crear directorios necesarios
|
# Crear directorios necesarios
|
||||||
mkdir -p "$LANG_DIR"
|
mkdir -p "$LANG_DIR"
|
||||||
|
|
||||||
@ -121,7 +137,6 @@ check_updates() {
|
|||||||
msg_info "$UPDATE_POSTPONED"
|
msg_info "$UPDATE_POSTPONED"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Se eliminó el mensaje cuando las versiones son iguales
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
msg_error "$UPDATE_CHECK_ERROR"
|
msg_error "$UPDATE_CHECK_ERROR"
|
||||||
@ -164,10 +179,20 @@ show_config_menu() {
|
|||||||
# Mostrar menú principal
|
# Mostrar menú principal
|
||||||
show_menu() {
|
show_menu() {
|
||||||
while true; do
|
while true; do
|
||||||
OPTION=$(whiptail --title "$MENU_TITLE" --menu "$SELECT_OPTION" 15 60 3 \
|
if $USE_WHIPTAIL; then
|
||||||
"1" "$OPTION_1" \
|
OPTION=$(whiptail --title "$MENU_TITLE" --menu "$SELECT_OPTION" 15 60 3 \
|
||||||
"2" "$OPTION_2" \
|
"1" "$OPTION_1" \
|
||||||
"3" "$OPTION_3" 3>&1 1>&2 2>&3)
|
"2" "$OPTION_2" \
|
||||||
|
"3" "$OPTION_3" 3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
clear
|
||||||
|
echo -e "${YW}=== $MENU_TITLE ===${CL}"
|
||||||
|
echo "1) $OPTION_2"
|
||||||
|
echo "2) $OPTION_3"
|
||||||
|
echo "q) $EXIT_MESSAGE"
|
||||||
|
echo
|
||||||
|
read -p "$SELECT_OPTION " OPTION
|
||||||
|
fi
|
||||||
|
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
1)
|
1)
|
||||||
@ -177,6 +202,9 @@ show_menu() {
|
|||||||
else
|
else
|
||||||
msg_error "$SCRIPT_ERROR"
|
msg_error "$SCRIPT_ERROR"
|
||||||
fi
|
fi
|
||||||
|
if ! $USE_WHIPTAIL; then
|
||||||
|
read -p "$PRESS_ENTER"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
msg_info "$NETWORK_REPAIR_RUNNING"
|
msg_info "$NETWORK_REPAIR_RUNNING"
|
||||||
@ -185,19 +213,32 @@ show_menu() {
|
|||||||
else
|
else
|
||||||
msg_error "$NETWORK_REPAIR_ERROR"
|
msg_error "$NETWORK_REPAIR_ERROR"
|
||||||
fi
|
fi
|
||||||
|
if ! $USE_WHIPTAIL; then
|
||||||
|
read -p "$PRESS_ENTER"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
show_config_menu
|
show_config_menu
|
||||||
;;
|
;;
|
||||||
|
q|Q)
|
||||||
|
if ! $USE_WHIPTAIL; then
|
||||||
|
msg_ok "$EXIT_MESSAGE"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
msg_ok "$EXIT_MESSAGE"
|
if $USE_WHIPTAIL; then
|
||||||
exit 0
|
msg_ok "$EXIT_MESSAGE"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
msg_error "$INVALID_OPTION"
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Verificar dependencias
|
# Verificar dependencias
|
||||||
if ! command -v whiptail &> /dev/null; then
|
if ! command -v whiptail &> /dev/null; then
|
||||||
msg_info "$DEPS_INSTALLING"
|
msg_info "$DEPS_INSTALLING"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user