ProxMenux/install_proxmenux.sh

56 lines
1.6 KiB
Bash
Raw Normal View History

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
2024-12-20 21:44:20 +01:00
# Verificar que se ejecute como root
if [ "$(id -u)" -ne 0 ]; then
echo "Este script debe ejecutarse como root." >&2
exit 1
fi
2024-12-20 18:54:00 +01:00
2024-12-20 21:41:34 +01:00
# Crear las carpetas necesarias
2024-12-20 21:44:20 +01:00
echo "Creando carpetas necesarias..."
mkdir -p "$LANG_DIR"
# Descargar el script principal (menu.sh)
echo "Descargando el script principal..."
wget -qO "$INSTALL_DIR/$MENU_SCRIPT" "$REPO_URL/$MENU_SCRIPT"
if [ $? -ne 0 ]; then
echo "Error al descargar el script principal. Verifica la URL y tu conexión a Internet." >&2
exit 1
2024-12-20 18:54:00 +01:00
fi
2024-12-20 21:44:20 +01:00
# Descargar archivos de idioma
echo "Descargando archivos de idioma..."
for LANG in es en; do
wget -qO "$LANG_DIR/$LANG.lang" "$REPO_URL/lang/$LANG.lang"
2024-12-20 21:27:49 +01:00
if [ $? -ne 0 ]; then
2024-12-20 21:44:20 +01:00
echo "Error al descargar el archivo de idioma '$LANG.lang'. Verifica la URL y tu conexión a Internet." >&2
2024-12-20 21:27:49 +01:00
exit 1
fi
2024-12-20 21:44:20 +01:00
done
# Descargar la versión inicial
echo "Descargando archivo de versión inicial..."
wget -qO "$LOCAL_VERSION_FILE" "$REPO_URL/version.txt"
if [ $? -ne 0 ]; then
echo "Error al descargar el archivo de versión. Verifica la URL y tu conexión a Internet." >&2
exit 1
2024-12-20 21:41:34 +01:00
fi
2024-12-20 21:44:20 +01:00
# Asignar permisos de ejecución al script principal
chmod +x "$INSTALL_DIR/$MENU_SCRIPT"
2024-12-20 18:54:00 +01:00
2024-12-20 21:44:20 +01:00
# Confirmación
echo "ProxMenux ha sido instalado correctamente."
echo "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