2024-12-20 18:54:00 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Configuración
|
|
|
|
REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
|
2024-12-20 21:44:20 +01:00
|
|
|
INSTALL_DIR="/usr/local/bin"
|
2024-12-20 21:41:34 +01:00
|
|
|
BASE_DIR="/usr/local/share/proxmenux"
|
|
|
|
LANG_DIR="$BASE_DIR/lang"
|
|
|
|
LOCAL_VERSION_FILE="$BASE_DIR/version.txt"
|
2024-12-20 21:44:20 +01:00
|
|
|
MENU_SCRIPT="menu.sh"
|
2024-12-20 21:41:34 +01:00
|
|
|
|
2025-01-09 21:37:09 +01:00
|
|
|
# Colores para salida
|
|
|
|
YW="\033[33m"; GN="\033[1;92m"; RD="\033[01;31m"; CL="\033[m"
|
|
|
|
msg_info() { echo -e " ${YW}[INFO] $1${CL}"; }
|
|
|
|
msg_ok() { echo -e " ${GN}[OK] $1${CL}"; }
|
|
|
|
msg_error() { echo -e " ${RD}[ERROR] $1${CL}"; }
|
|
|
|
|
2024-12-20 21:44:20 +01:00
|
|
|
# Verificar que se ejecute como root
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
2025-01-09 21:37:09 +01:00
|
|
|
msg_error "Este script debe ejecutarse como root."
|
2024-12-20 21:44:20 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2024-12-20 18:54:00 +01:00
|
|
|
|
2025-01-09 21:37:09 +01:00
|
|
|
# Verificar dependencias
|
|
|
|
if ! command -v whiptail &> /dev/null; then
|
|
|
|
msg_info "Instalando whiptail..."
|
|
|
|
if apt-get update && apt-get install -y whiptail; then
|
|
|
|
msg_ok "whiptail instalado correctamente."
|
|
|
|
else
|
|
|
|
msg_error "Error al instalar whiptail. Por favor, instálalo manualmente."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-12-20 21:41:34 +01:00
|
|
|
# Crear las carpetas necesarias
|
2025-01-09 21:37:09 +01:00
|
|
|
msg_info "Creando carpetas necesarias..."
|
2024-12-20 21:44:20 +01:00
|
|
|
mkdir -p "$LANG_DIR"
|
2025-01-09 21:37:09 +01:00
|
|
|
msg_ok "Carpetas creadas."
|
2024-12-20 21:44:20 +01:00
|
|
|
|
|
|
|
# Descargar el script principal (menu.sh)
|
2025-01-09 21:37:09 +01:00
|
|
|
msg_info "Descargando el script principal..."
|
|
|
|
if wget -qO "$INSTALL_DIR/$MENU_SCRIPT" "$REPO_URL/$MENU_SCRIPT"; then
|
|
|
|
chmod +x "$INSTALL_DIR/$MENU_SCRIPT"
|
|
|
|
msg_ok "Script principal descargado."
|
|
|
|
else
|
|
|
|
msg_error "Error al descargar el script principal. Verifica la URL y tu conexión a Internet."
|
2024-12-20 21:44:20 +01:00
|
|
|
exit 1
|
2024-12-20 18:54:00 +01:00
|
|
|
fi
|
|
|
|
|
2024-12-20 21:44:20 +01:00
|
|
|
# Descargar la versión inicial
|
2025-01-09 21:37:09 +01:00
|
|
|
msg_info "Descargando archivo de versión..."
|
|
|
|
if wget -qO "$LOCAL_VERSION_FILE" "$REPO_URL/version.txt"; then
|
|
|
|
msg_ok "Archivo de versión descargado."
|
|
|
|
else
|
|
|
|
msg_error "Error al descargar el archivo de versión."
|
2024-12-20 21:44:20 +01:00
|
|
|
exit 1
|
2024-12-20 21:41:34 +01:00
|
|
|
fi
|
|
|
|
|
2024-12-20 21:44:20 +01:00
|
|
|
# Confirmación
|
2025-01-09 21:37:09 +01:00
|
|
|
msg_ok "ProxMenux ha sido instalado correctamente."
|
|
|
|
msg_info "Ejecuta 'menu.sh' como root para iniciar el menú."
|
2024-12-20 18:54:00 +01:00
|
|
|
|
2024-12-20 21:44:20 +01:00
|
|
|
# Finalizar
|
|
|
|
exit 0
|