From 4789cddbfc2f6d2b4d44943d747227cce251a54c Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Fri, 28 Mar 2025 14:26:11 +0100 Subject: [PATCH] Update installer to handle dev and prod repos --- .../python-installer/oginstaller-v3.py | 14 +++++++++++--- .../python-installer/opengnsys_installer-v2.sh | 11 +++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/non_graf_installer/python-installer/oginstaller-v3.py b/non_graf_installer/python-installer/oginstaller-v3.py index c8ed07f..c39191f 100644 --- a/non_graf_installer/python-installer/oginstaller-v3.py +++ b/non_graf_installer/python-installer/oginstaller-v3.py @@ -6,6 +6,7 @@ import requests # Importar el módulo requests import time # Importar time para simular el progreso import threading # Importar threading para leer el log en tiempo real import socket +import sys # Importar sys para leer los argumentos del script CONFIGS_DIR = "/tmp/oginstall" os.makedirs(CONFIGS_DIR, exist_ok=True) @@ -29,8 +30,11 @@ def get_network_interfaces(): def get_available_versions(): """Obtiene la lista de versiones desde el archivo JSON remoto.""" try: - url = "https://ognproject.evlt.uma.es/debian-opengnsys/versions.json" - # Redirigir la salida de la descarga a /dev/null + # Determinar la URL según el argumento recibido + if len(sys.argv) > 1 and sys.argv[1].lower() == "devel": + url = "https://ognproject.evlt.uma.es/debian-opengnsys/versions-dev.json" + else: + url = "https://ognproject.evlt.uma.es/debian-opengnsys/versions-prod.json" response = requests.get(url, timeout=10) response.raise_for_status() # Lanza una excepción si la respuesta no es 200 OK data = response.json() @@ -459,7 +463,11 @@ class MyApp(npyscreen.NPSAppManaged): # Añadir el repositorio try: selected_tag = self.selected_tag # Obtener el tag seleccionado - repo_line = f'deb http://ognproject.evlt.uma.es/debian-opengnsys/opengnsys-devel/{selected_tag} noble main' + # Determinar el valor de repo_line según el argumento recibido + if len(sys.argv) > 1 and sys.argv[1].lower() == "devel": + repo_line = f'deb http://ognproject.evlt.uma.es/debian-opengnsys/opengnsys-devel/{selected_tag} noble main' + else: + repo_line = f'deb http://ognproject.evlt.uma.es/debian-opengnsys/opengnsys/{selected_tag} noble main' with open('/etc/apt/sources.list.d/opengnsys.list', 'w') as repo_file: repo_file.write(repo_line + '\n') except Exception: diff --git a/non_graf_installer/python-installer/opengnsys_installer-v2.sh b/non_graf_installer/python-installer/opengnsys_installer-v2.sh index 2361724..1428a6e 100755 --- a/non_graf_installer/python-installer/opengnsys_installer-v2.sh +++ b/non_graf_installer/python-installer/opengnsys_installer-v2.sh @@ -7,8 +7,11 @@ BRANCH=${BRANCH:-main} GIT_SSL_NO_VERIFY=1 GIT_REPO="https://ognproject.evlt.uma.es/gitea/api/v1/repos/opengnsys/oginstaller/archive/$BRANCH.zip" export GIT_SSL_NO_VERIFY +DEVEL=$1 - +if [ "$DEVEL" == "devel" ]; then + INSTALL_DEVEL=1 +fi install_packages() { apt-get update @@ -43,7 +46,11 @@ extract_installer() { create_questions() { echo "Creating questions..." - python3 /tmp/oginstall/oginstaller-v3.py + if [ $INSTALL_DEVEL ] ; then + python3 /tmp/oginstall/oginstaller-v3.py devel + else + python3 /tmp/oginstall/oginstaller-v3.py + fi deactivate }