diff --git a/non_graf_installer/python-installer/oginstaller-v3.py b/non_graf_installer/python-installer/oginstaller-v3.py index 4661895..c8ed07f 100644 --- a/non_graf_installer/python-installer/oginstaller-v3.py +++ b/non_graf_installer/python-installer/oginstaller-v3.py @@ -233,7 +233,7 @@ class OgDhcpForm(ComponentForm): class OgBootForm(ComponentForm): component_name = "ogboot" - + download_url = "https://ognproject.evlt.uma.es/oglive/" def configure_fields(self): # Obtener la lista de oglives oglives = get_oglive_list() @@ -269,7 +269,7 @@ class OgBootForm(ComponentForm): # Guardar las configuraciones self.parentApp.configurations[self.component_name] = { - "ogliveUrl": selected_oglive, + "ogliveUrl": self.download_url + selected_oglive, "ip": self.fields["ip"]["widget"].value, "port": self.fields["port"]["widget"].value, "ogcoreUrl": self.fields["ogcoreUrl"]["widget"].value, @@ -309,7 +309,7 @@ class InstallationProgressForm(npyscreen.FormBaseNew): # Crear la parte inferior para el log en tiempo real self.log_box = self.add( npyscreen.BoxTitle, - name="Log en tiempo real", + name="Log de instalación", rely=int(self.lines * 0.5), # Mitad inferior scroll_exit=True ) @@ -384,6 +384,23 @@ def install_components_with_ui(form, components, selected_tag): else: form.update_progress(f"Paquete {package} instalado correctamente.") installed_packages.append(package) # Agregar a la lista de éxitos + + # Instalar ogclient si se está instalando ogboot + if package == "ogboot": + form.update_progress("Instalando paquete adicional: ogclient") + install_command = "DEBIAN_FRONTEND=noninteractive apt-get install -y ogclient" + process = subprocess.Popen( + install_command, shell=True, text=True, stdout=log_file, stderr=log_file + ) + process.wait() + + if process.returncode != 0: + error_message = f"Error al instalar el paquete ogclient. Consulta el archivo de registro: {log_file_path}" + form.update_progress(error_message) + failed_packages.append("ogclient") + else: + form.update_progress("Paquete ogclient instalado correctamente.") + installed_packages.append("ogclient") except Exception as e: form.update_progress(f"Error durante la instalación: {e}") failed_packages.append("Error general durante la instalación") diff --git a/non_graf_installer/python-installer/opengnsys_installer-v2.sh b/non_graf_installer/python-installer/opengnsys_installer-v2.sh new file mode 100755 index 0000000..2361724 --- /dev/null +++ b/non_graf_installer/python-installer/opengnsys_installer-v2.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Setup installer environment + + +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 + + + +install_packages() { + apt-get update + apt-get install -y curl jq unzip python3 python3-git +} + + +create_python_venv() { + apt-get install -y python3-venv + python3 -m venv /tmp/oginstall/venv + source /tmp/oginstall/venv/bin/activate + pip install -r /tmp/oginstall/requirements.txt +} + +download_installer() { + + rm -f /tmp/oginstaller.zip + rm -rf /tmp/oginstaller-$BRANCH + rm -rf /tmp/oginstaller + + curl -q -k $GIT_REPO -H 'accept: application/json' -o /tmp/oginstaller.zip + unzip /tmp/oginstaller.zip -d /tmp + mv /tmp/oginstaller /tmp/oginstaller-$BRANCH +} + +extract_installer() { + rm -rf /tmp/oginstall + mkdir -p /tmp/oginstall + cp -r /tmp/oginstaller-$BRANCH/non_graf_installer/python-installer/* /tmp/oginstall/ + chmod 755 /tmp/oginstall/*.py +} + +create_questions() { + echo "Creating questions..." + python3 /tmp/oginstall/oginstaller-v3.py + deactivate +} + +clean_tmp() { + rm -rf /tmp/oginstall + rm -rf /tmp/oginstaller-$BRANCH + rm -f /tmp/oginstaller.zip +} + + +install_packages +download_installer +extract_installer +create_python_venv +create_questions +clean_tmp