Detects oggui interface automatically
oginstaller/pipeline/head This commit looks good Details

move-to-docker
Nicolas Arenas 2024-11-04 13:00:45 +01:00
parent 85c38b33a6
commit b9edd5d0af
1 changed files with 15 additions and 0 deletions

View File

@ -45,6 +45,20 @@ EOF
function install_oggui_docker() {
# Leer el JSON y extraer los valores con jq
ogcore_ip=$(jq -r '.ogcore_ip' /opt/opengnsys/ogGui/installer/config.json)
if [ -z "$ogcore_ip" ]; then
# Obtiene el nombre del interfaz asociado a la ruta por defecto
interface=$(ip route | grep default | awk '{print $5}')
# Si se encuentra el interfaz, obtiene su dirección IP
if [ -n "$interface" ]; then
ip_address=$(ip -o -4 addr show "$interface" | awk '{print $4}' | cut -d'/' -f1)
ogcore_ip=$ip_address
else
echo "No se pudo determinar el interfaz asociado a la ruta por defecto."
exit 1
fi
fi
oggui_version=$(jq -r '.container_version' /opt/opengnsys/ogGui/installer/config.json)
# Exportar los valores como variables de entorno
export OGCORE_IP="$ogcore_ip"
@ -61,6 +75,7 @@ Requires=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker run --rm --name ogGui-app -p 4200:4200 -v $ENV_FILE:/app/.env opengnsys/oggui:$oggui_version
ExecStop=/usr/bin/docker stop ogGui-app