From b652142aaa768bd1e6d55e9d6dcd2d750cd7e07f Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 11:53:34 +0100 Subject: [PATCH 01/10] Reestructura de los directorios --- component-installer.sh | 150 ------------------ .../art}/Opengnsys-wallpaper.jpg | Bin {art => graf_installer/art}/logo_ogw.png | Bin .../art}/opengnsys-logo.png | Bin builder.sh => graf_installer/builder.sh | 0 buildlib.sh => graf_installer/buildlib.sh | 0 .../calamares}/modules/bootloader.conf | 0 .../modules/bootloader/bootloader.conf | 0 .../calamares}/modules/mount.conf | 0 .../calamares}/modules/mount/mount.conf | 0 .../calamares}/modules/packages.conf | 0 .../calamares}/modules/packages/packages.conf | 0 .../calamares}/modules/shell_chroot.conf | 0 .../calamares}/modules/shell_nonchroot.conf | 0 .../modules/shellprocess/shell_chroot.conf | 0 .../modules/shellprocess/shell_nonchroot.conf | 0 .../calamares}/modules/unpackfs.conf | 0 .../calamares}/modules/unpackfs/unpackfs.conf | 0 .../calamares}/modules/users.conf | 0 .../calamares}/modules/users/users.conf | 0 .../calamares}/settings.conf | 0 .../opengnsys/Opengnsys-wallpaper.jpg | Bin .../src/branding/opengnsys/banner.png | Bin .../src/branding/opengnsys/banner.png.license | 0 .../src/branding/opengnsys/branding.desc | 0 .../opengnsys/lang/calamares-default_ar.qm | Bin .../opengnsys/lang/calamares-default_en.qm | Bin .../opengnsys/lang/calamares-default_eo.qm | Bin .../opengnsys/lang/calamares-default_fr.qm | Bin .../opengnsys/lang/calamares-default_nl.qm | Bin .../src/branding/opengnsys/languages.png | Bin .../branding/opengnsys/languages.png.license | 0 .../src/branding/opengnsys/logo_ogw.png | Bin .../src/branding/opengnsys/show.qml | 0 .../src/branding/opengnsys/squid.png | Bin .../src/branding/opengnsys/squid.png.license | 0 .../src/branding/opengnsys/stylesheet.qss | 0 .../calamares}/src/modules | 0 .../chroot_setup.sh | 0 {conf => graf_installer/conf}/pcmanfm.conf | 0 pat.txt => graf_installer/pat.txt | 0 .../provision_ogcore.sh | 0 .../provision_oggui.sh | 0 root_passwd => graf_installer/root_passwd | 0 .../setup_chroot_ubuntu.sh | 0 .../component-installer.sh | 0 .../component-installer}/provision_ogcore.sh | 0 .../component-installer}/provision_oggui.sh | 0 .../provision_ogrepository.sh | 3 +- .../python-installer}/oginstaller-v2.py | 0 .../python-installer}/oginstaller.py | 0 .../python-installer}/oginstaller.sh | 0 .../python-installer}/opengnsys_installer.sh | 0 .../python-installer}/requirements.txt | 0 openGnsys-installer.sh | 103 ------------ 55 files changed, 2 insertions(+), 254 deletions(-) delete mode 100644 component-installer.sh rename {art => graf_installer/art}/Opengnsys-wallpaper.jpg (100%) rename {art => graf_installer/art}/logo_ogw.png (100%) rename {art => graf_installer/art}/opengnsys-logo.png (100%) rename builder.sh => graf_installer/builder.sh (100%) rename buildlib.sh => graf_installer/buildlib.sh (100%) rename {calamares => graf_installer/calamares}/modules/bootloader.conf (100%) rename {calamares => graf_installer/calamares}/modules/bootloader/bootloader.conf (100%) rename {calamares => graf_installer/calamares}/modules/mount.conf (100%) rename {calamares => graf_installer/calamares}/modules/mount/mount.conf (100%) rename {calamares => graf_installer/calamares}/modules/packages.conf (100%) rename {calamares => graf_installer/calamares}/modules/packages/packages.conf (100%) rename {calamares => graf_installer/calamares}/modules/shell_chroot.conf (100%) rename {calamares => graf_installer/calamares}/modules/shell_nonchroot.conf (100%) rename {calamares => graf_installer/calamares}/modules/shellprocess/shell_chroot.conf (100%) rename {calamares => graf_installer/calamares}/modules/shellprocess/shell_nonchroot.conf (100%) rename {calamares => graf_installer/calamares}/modules/unpackfs.conf (100%) rename {calamares => graf_installer/calamares}/modules/unpackfs/unpackfs.conf (100%) rename {calamares => graf_installer/calamares}/modules/users.conf (100%) rename {calamares => graf_installer/calamares}/modules/users/users.conf (100%) rename {calamares => graf_installer/calamares}/settings.conf (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/Opengnsys-wallpaper.jpg (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/banner.png (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/banner.png.license (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/branding.desc (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/lang/calamares-default_ar.qm (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/lang/calamares-default_en.qm (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/lang/calamares-default_eo.qm (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/lang/calamares-default_fr.qm (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/lang/calamares-default_nl.qm (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/languages.png (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/languages.png.license (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/logo_ogw.png (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/show.qml (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/squid.png (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/squid.png.license (100%) rename {calamares => graf_installer/calamares}/src/branding/opengnsys/stylesheet.qss (100%) rename {calamares => graf_installer/calamares}/src/modules (100%) rename chroot_setup.sh => graf_installer/chroot_setup.sh (100%) rename {conf => graf_installer/conf}/pcmanfm.conf (100%) rename pat.txt => graf_installer/pat.txt (100%) rename provision_ogcore.sh => graf_installer/provision_ogcore.sh (100%) rename provision_oggui.sh => graf_installer/provision_oggui.sh (100%) rename root_passwd => graf_installer/root_passwd (100%) rename setup_chroot_ubuntu.sh => graf_installer/setup_chroot_ubuntu.sh (100%) rename {component-installer => non_graf_installer/component-installer}/component-installer.sh (100%) rename {component-installer => non_graf_installer/component-installer}/provision_ogcore.sh (100%) rename {component-installer => non_graf_installer/component-installer}/provision_oggui.sh (100%) rename {component-installer => non_graf_installer/component-installer}/provision_ogrepository.sh (97%) rename {python-installer => non_graf_installer/python-installer}/oginstaller-v2.py (100%) rename {python-installer => non_graf_installer/python-installer}/oginstaller.py (100%) rename {python-installer => non_graf_installer/python-installer}/oginstaller.sh (100%) rename {python-installer => non_graf_installer/python-installer}/opengnsys_installer.sh (100%) rename {python-installer => non_graf_installer/python-installer}/requirements.txt (100%) delete mode 100644 openGnsys-installer.sh diff --git a/component-installer.sh b/component-installer.sh deleted file mode 100644 index 34819a3..0000000 --- a/component-installer.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/bash - -# Paso 1: Seleccionar los componentes -# Los componentes a instalar se encuentran en el directorio /tmp/opengnsys-installer-configs - -# Set configuration - -function install_docker() { - apt-get -y update - apt-get -y install ca-certificates curl - install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc - chmod a+r /etc/apt/keyrings/docker.asc - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - tee /etc/apt/sources.list.d/docker.list > /dev/null - apt-get -y update - apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - systemctl enable docker -} - -function install_ogcore_docker() { -cat < /etc/systemd/system/ogcore.service -[Unit] -Description=Servicio para ejecutar Docker Compose de ogCore -After=docker.service -Requires=docker.service - -[Service] -WorkingDirectory=/opt/opengnsys/ogCore/repo/ -ExecStart=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml up -ExecStartPost=/opengnsys-installer/provision_ogcore.sh -ExecStop=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml stop -Restart=always - -[Install] -WantedBy=multi-user.target -EOF - - systemctl daemon-reload - systemctl enable --now ogcore -} - - - -function install_oggui_docker() { - # Sacar la IP del ogCore de la configuración - oggui_version=$(jq -r '.container_version' /opt/opengnsys/ogGui/installer/config.json) - # Exportar los valores como variables de entorno - ENV_DIR=/opt/opengnsys/ogGui/etc/ - ENV_FILE=$ENV_DIR/.env - - cat < /etc/systemd/system/oggui-app.service -[Unit] -Description=Servicio para contenedor Docker de OgGui -After=docker.service -Requires=docker.service - -[Service] -Restart=always -ExecStartPre=/opengnsys-installer/provision_oggui.sh -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 - -[Install] -WantedBy=multi-user.target -EOF - - systemctl daemon-reload - systemctl enable --now oggui-app - -} - - -COMPONENTS="ogCore ogGui ogDhcp ogBoot ogRepository" -CONFIGS_DIR=/opengnsys-installer/ -PAT_FILE=/opengnsys-installer/pat.txt -PAT=$(cat $PAT_FILE | tr -d '\n\r\t') - -OPENGNSYS_BASE_URL="https://$PAT@ognproject.evlt.uma.es/gitea/opengnsys" - -OGBOOT_REPO="$OPENGNSYS_BASE_URL/ogboot.git" -OGCORE_REPO="$OPENGNSYS_BASE_URL/ogcore.git" -OGDHCP_REPO="$OPENGNSYS_BASE_URL/ogdhcp.git" -OGGUI_REPO="$OPENGNSYS_BASE_URL/oggui.git" -OGREPOSITORY_REPO="$OPENGNSYS_BASE_URL/ogrepository.git" - -export GIT_SSL_NO_VERIFY=1 -echo ======================================== > /etc/issue -echo "OpenGnSys Installer" >> /etc/issue -echo "Componentes instalados:" >> /etc/issue - - - -for component in $COMPONENTS -do - config_file="config_${component}.json" - if [ -f $CONFIGS_DIR/$config_file ]; then - echo "Componente $component seleccionado, instalando configuración..." - component_dir=/opt/opengnsys/$component - mkdir -p $component_dir/installer - mkdir -p $component_dir/repo - cp $CONFIGS_DIR/$config_file /opt/opengnsys/$component/installer/config.json - - case $component in - ogCore) - echo "Instalando ogCore..." - OGCORE_BRANCH=main - container_version=$(jq -r '.container_version' /opt/opengnsys/ogCore/installer/config.json) - git clone --branch "$OGCORE_BRANCH" "$OGCORE_REPO" "$component_dir/repo" - # Copy the docker-compose-deploy.yml file to /opt/opengnsys/ogCore/etc/ - mkdir -p $component_dir/etc/ - cp $component_dir/repo/docker-compose-deploy.yml $component_dir/etc/ - sed -i "s/static/$container_version/g" $component_dir/repo/docker-compose-deploy.yml - echo - ogCore >> /etc/issue - install_docker - install_ogcore_docker - ;; - ogGui) - echo "Instalando ogGui..." - OGGUI_BRANCH=main - git clone --branch "$OGGUI_BRANCH" "$OGGUI_REPO" "$component_dir/repo" - echo - ogGui >> /etc/issue - install_docker - install_oggui_docker - ;; - ogDhcp) - echo "Instalando ogDhcp..." - git clone "$OGDHCP_REPO" "$component_dir/repo" - echo - ogDhcp >> /etc/issue - ;; - ogBoot) - echo "Instalando ogBoot..." - git clone "$OGBOOT_REPO" "$component_dir/repo" - echo - ogBoot >> /etc/issue - ;; - ogRepository) - echo "Instalando ogRepository..." - git clone "$OGREPOSITORY_REPO" "$component_dir/repo" - echo - ogRepository >> /etc/issue - ;; - *) - echo "Componente $component no reconocido" - ;; - esac - continue - fi -done - -echo ======================================== >> /etc/issue -rm -f $PAT_FILE diff --git a/art/Opengnsys-wallpaper.jpg b/graf_installer/art/Opengnsys-wallpaper.jpg similarity index 100% rename from art/Opengnsys-wallpaper.jpg rename to graf_installer/art/Opengnsys-wallpaper.jpg diff --git a/art/logo_ogw.png b/graf_installer/art/logo_ogw.png similarity index 100% rename from art/logo_ogw.png rename to graf_installer/art/logo_ogw.png diff --git a/art/opengnsys-logo.png b/graf_installer/art/opengnsys-logo.png similarity index 100% rename from art/opengnsys-logo.png rename to graf_installer/art/opengnsys-logo.png diff --git a/builder.sh b/graf_installer/builder.sh similarity index 100% rename from builder.sh rename to graf_installer/builder.sh diff --git a/buildlib.sh b/graf_installer/buildlib.sh similarity index 100% rename from buildlib.sh rename to graf_installer/buildlib.sh diff --git a/calamares/modules/bootloader.conf b/graf_installer/calamares/modules/bootloader.conf similarity index 100% rename from calamares/modules/bootloader.conf rename to graf_installer/calamares/modules/bootloader.conf diff --git a/calamares/modules/bootloader/bootloader.conf b/graf_installer/calamares/modules/bootloader/bootloader.conf similarity index 100% rename from calamares/modules/bootloader/bootloader.conf rename to graf_installer/calamares/modules/bootloader/bootloader.conf diff --git a/calamares/modules/mount.conf b/graf_installer/calamares/modules/mount.conf similarity index 100% rename from calamares/modules/mount.conf rename to graf_installer/calamares/modules/mount.conf diff --git a/calamares/modules/mount/mount.conf b/graf_installer/calamares/modules/mount/mount.conf similarity index 100% rename from calamares/modules/mount/mount.conf rename to graf_installer/calamares/modules/mount/mount.conf diff --git a/calamares/modules/packages.conf b/graf_installer/calamares/modules/packages.conf similarity index 100% rename from calamares/modules/packages.conf rename to graf_installer/calamares/modules/packages.conf diff --git a/calamares/modules/packages/packages.conf b/graf_installer/calamares/modules/packages/packages.conf similarity index 100% rename from calamares/modules/packages/packages.conf rename to graf_installer/calamares/modules/packages/packages.conf diff --git a/calamares/modules/shell_chroot.conf b/graf_installer/calamares/modules/shell_chroot.conf similarity index 100% rename from calamares/modules/shell_chroot.conf rename to graf_installer/calamares/modules/shell_chroot.conf diff --git a/calamares/modules/shell_nonchroot.conf b/graf_installer/calamares/modules/shell_nonchroot.conf similarity index 100% rename from calamares/modules/shell_nonchroot.conf rename to graf_installer/calamares/modules/shell_nonchroot.conf diff --git a/calamares/modules/shellprocess/shell_chroot.conf b/graf_installer/calamares/modules/shellprocess/shell_chroot.conf similarity index 100% rename from calamares/modules/shellprocess/shell_chroot.conf rename to graf_installer/calamares/modules/shellprocess/shell_chroot.conf diff --git a/calamares/modules/shellprocess/shell_nonchroot.conf b/graf_installer/calamares/modules/shellprocess/shell_nonchroot.conf similarity index 100% rename from calamares/modules/shellprocess/shell_nonchroot.conf rename to graf_installer/calamares/modules/shellprocess/shell_nonchroot.conf diff --git a/calamares/modules/unpackfs.conf b/graf_installer/calamares/modules/unpackfs.conf similarity index 100% rename from calamares/modules/unpackfs.conf rename to graf_installer/calamares/modules/unpackfs.conf diff --git a/calamares/modules/unpackfs/unpackfs.conf b/graf_installer/calamares/modules/unpackfs/unpackfs.conf similarity index 100% rename from calamares/modules/unpackfs/unpackfs.conf rename to graf_installer/calamares/modules/unpackfs/unpackfs.conf diff --git a/calamares/modules/users.conf b/graf_installer/calamares/modules/users.conf similarity index 100% rename from calamares/modules/users.conf rename to graf_installer/calamares/modules/users.conf diff --git a/calamares/modules/users/users.conf b/graf_installer/calamares/modules/users/users.conf similarity index 100% rename from calamares/modules/users/users.conf rename to graf_installer/calamares/modules/users/users.conf diff --git a/calamares/settings.conf b/graf_installer/calamares/settings.conf similarity index 100% rename from calamares/settings.conf rename to graf_installer/calamares/settings.conf diff --git a/calamares/src/branding/opengnsys/Opengnsys-wallpaper.jpg b/graf_installer/calamares/src/branding/opengnsys/Opengnsys-wallpaper.jpg similarity index 100% rename from calamares/src/branding/opengnsys/Opengnsys-wallpaper.jpg rename to graf_installer/calamares/src/branding/opengnsys/Opengnsys-wallpaper.jpg diff --git a/calamares/src/branding/opengnsys/banner.png b/graf_installer/calamares/src/branding/opengnsys/banner.png similarity index 100% rename from calamares/src/branding/opengnsys/banner.png rename to graf_installer/calamares/src/branding/opengnsys/banner.png diff --git a/calamares/src/branding/opengnsys/banner.png.license b/graf_installer/calamares/src/branding/opengnsys/banner.png.license similarity index 100% rename from calamares/src/branding/opengnsys/banner.png.license rename to graf_installer/calamares/src/branding/opengnsys/banner.png.license diff --git a/calamares/src/branding/opengnsys/branding.desc b/graf_installer/calamares/src/branding/opengnsys/branding.desc similarity index 100% rename from calamares/src/branding/opengnsys/branding.desc rename to graf_installer/calamares/src/branding/opengnsys/branding.desc diff --git a/calamares/src/branding/opengnsys/lang/calamares-default_ar.qm b/graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_ar.qm similarity index 100% rename from calamares/src/branding/opengnsys/lang/calamares-default_ar.qm rename to graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_ar.qm diff --git a/calamares/src/branding/opengnsys/lang/calamares-default_en.qm b/graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_en.qm similarity index 100% rename from calamares/src/branding/opengnsys/lang/calamares-default_en.qm rename to graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_en.qm diff --git a/calamares/src/branding/opengnsys/lang/calamares-default_eo.qm b/graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_eo.qm similarity index 100% rename from calamares/src/branding/opengnsys/lang/calamares-default_eo.qm rename to graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_eo.qm diff --git a/calamares/src/branding/opengnsys/lang/calamares-default_fr.qm b/graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_fr.qm similarity index 100% rename from calamares/src/branding/opengnsys/lang/calamares-default_fr.qm rename to graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_fr.qm diff --git a/calamares/src/branding/opengnsys/lang/calamares-default_nl.qm b/graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_nl.qm similarity index 100% rename from calamares/src/branding/opengnsys/lang/calamares-default_nl.qm rename to graf_installer/calamares/src/branding/opengnsys/lang/calamares-default_nl.qm diff --git a/calamares/src/branding/opengnsys/languages.png b/graf_installer/calamares/src/branding/opengnsys/languages.png similarity index 100% rename from calamares/src/branding/opengnsys/languages.png rename to graf_installer/calamares/src/branding/opengnsys/languages.png diff --git a/calamares/src/branding/opengnsys/languages.png.license b/graf_installer/calamares/src/branding/opengnsys/languages.png.license similarity index 100% rename from calamares/src/branding/opengnsys/languages.png.license rename to graf_installer/calamares/src/branding/opengnsys/languages.png.license diff --git a/calamares/src/branding/opengnsys/logo_ogw.png b/graf_installer/calamares/src/branding/opengnsys/logo_ogw.png similarity index 100% rename from calamares/src/branding/opengnsys/logo_ogw.png rename to graf_installer/calamares/src/branding/opengnsys/logo_ogw.png diff --git a/calamares/src/branding/opengnsys/show.qml b/graf_installer/calamares/src/branding/opengnsys/show.qml similarity index 100% rename from calamares/src/branding/opengnsys/show.qml rename to graf_installer/calamares/src/branding/opengnsys/show.qml diff --git a/calamares/src/branding/opengnsys/squid.png b/graf_installer/calamares/src/branding/opengnsys/squid.png similarity index 100% rename from calamares/src/branding/opengnsys/squid.png rename to graf_installer/calamares/src/branding/opengnsys/squid.png diff --git a/calamares/src/branding/opengnsys/squid.png.license b/graf_installer/calamares/src/branding/opengnsys/squid.png.license similarity index 100% rename from calamares/src/branding/opengnsys/squid.png.license rename to graf_installer/calamares/src/branding/opengnsys/squid.png.license diff --git a/calamares/src/branding/opengnsys/stylesheet.qss b/graf_installer/calamares/src/branding/opengnsys/stylesheet.qss similarity index 100% rename from calamares/src/branding/opengnsys/stylesheet.qss rename to graf_installer/calamares/src/branding/opengnsys/stylesheet.qss diff --git a/calamares/src/modules b/graf_installer/calamares/src/modules similarity index 100% rename from calamares/src/modules rename to graf_installer/calamares/src/modules diff --git a/chroot_setup.sh b/graf_installer/chroot_setup.sh similarity index 100% rename from chroot_setup.sh rename to graf_installer/chroot_setup.sh diff --git a/conf/pcmanfm.conf b/graf_installer/conf/pcmanfm.conf similarity index 100% rename from conf/pcmanfm.conf rename to graf_installer/conf/pcmanfm.conf diff --git a/pat.txt b/graf_installer/pat.txt similarity index 100% rename from pat.txt rename to graf_installer/pat.txt diff --git a/provision_ogcore.sh b/graf_installer/provision_ogcore.sh similarity index 100% rename from provision_ogcore.sh rename to graf_installer/provision_ogcore.sh diff --git a/provision_oggui.sh b/graf_installer/provision_oggui.sh similarity index 100% rename from provision_oggui.sh rename to graf_installer/provision_oggui.sh diff --git a/root_passwd b/graf_installer/root_passwd similarity index 100% rename from root_passwd rename to graf_installer/root_passwd diff --git a/setup_chroot_ubuntu.sh b/graf_installer/setup_chroot_ubuntu.sh similarity index 100% rename from setup_chroot_ubuntu.sh rename to graf_installer/setup_chroot_ubuntu.sh diff --git a/component-installer/component-installer.sh b/non_graf_installer/component-installer/component-installer.sh similarity index 100% rename from component-installer/component-installer.sh rename to non_graf_installer/component-installer/component-installer.sh diff --git a/component-installer/provision_ogcore.sh b/non_graf_installer/component-installer/provision_ogcore.sh similarity index 100% rename from component-installer/provision_ogcore.sh rename to non_graf_installer/component-installer/provision_ogcore.sh diff --git a/component-installer/provision_oggui.sh b/non_graf_installer/component-installer/provision_oggui.sh similarity index 100% rename from component-installer/provision_oggui.sh rename to non_graf_installer/component-installer/provision_oggui.sh diff --git a/component-installer/provision_ogrepository.sh b/non_graf_installer/component-installer/provision_ogrepository.sh similarity index 97% rename from component-installer/provision_ogrepository.sh rename to non_graf_installer/component-installer/provision_ogrepository.sh index 64f9b25..a477931 100644 --- a/component-installer/provision_ogrepository.sh +++ b/non_graf_installer/component-installer/provision_ogrepository.sh @@ -10,6 +10,7 @@ OGPASS=${4:-"og"} INSTALL_DIR=/opt/opengnsys/ogrepository DOWNLOAD_DIR=${5:-"/tmp/ogrepository"} DEBIAN_FRONTEND=noninteractive +OGUSER_HOME=/opt/opengnsys export DEBIAN_FRONTEND export GIT_SSL_NO_VERIFY @@ -34,7 +35,7 @@ install_updcast () { add_user_ogrepository() { if ! id "$OGUSER" &>/dev/null; then echo "User ogrepository does not exist, creating it" - useradd -r -s /bin/bash $OGUSER + useradd -m -d $OGUSER_HOME -r -s /bin/bash $OGUSER fi if [ ! -f /etc/sudoers.d/$OGUSER ]; then echo "User $OGUSER does not have sudo permissions, adding it" diff --git a/python-installer/oginstaller-v2.py b/non_graf_installer/python-installer/oginstaller-v2.py similarity index 100% rename from python-installer/oginstaller-v2.py rename to non_graf_installer/python-installer/oginstaller-v2.py diff --git a/python-installer/oginstaller.py b/non_graf_installer/python-installer/oginstaller.py similarity index 100% rename from python-installer/oginstaller.py rename to non_graf_installer/python-installer/oginstaller.py diff --git a/python-installer/oginstaller.sh b/non_graf_installer/python-installer/oginstaller.sh similarity index 100% rename from python-installer/oginstaller.sh rename to non_graf_installer/python-installer/oginstaller.sh diff --git a/python-installer/opengnsys_installer.sh b/non_graf_installer/python-installer/opengnsys_installer.sh similarity index 100% rename from python-installer/opengnsys_installer.sh rename to non_graf_installer/python-installer/opengnsys_installer.sh diff --git a/python-installer/requirements.txt b/non_graf_installer/python-installer/requirements.txt similarity index 100% rename from python-installer/requirements.txt rename to non_graf_installer/python-installer/requirements.txt diff --git a/openGnsys-installer.sh b/openGnsys-installer.sh deleted file mode 100644 index 16a9893..0000000 --- a/openGnsys-installer.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - - -CONFIGS_DIR=/tmp/opengnsys-installer-configs -rm -rf $CONFIGS_DIR -mkdir -p $CONFIGS_DIR - -# Paso 1: Seleccionar los componentes -components=$(yad --list --title="Seleccionar componentes" \ - --text="Selecciona los componentes que deseas configurar:" \ - --checklist --multiple \ - --column="Seleccionar" --column="Componente" \ - FALSE "ogCore" \ - FALSE "ogGui" \ - FALSE "ogDhcp" \ - FALSE "ogBoot" \ - --width=400 --height=300 --center) - -# Verificar si el usuario seleccionó algún componente -if [[ -z "$components" ]]; then - yad --info --text="No seleccionaste ningún componente. Saliendo..." --center - exit 1 -fi - -for component in $components; do - selected_component=$(echo "$component" | cut -d '|' -f 2) - # Pedir la configuración específica para cada componente seleccionado - - - # Dividir la configuración en IP y ruta del fichero - config_file="config_${selected_component}.json" - case $selected_component in - "ogCore") - config=$(yad --form --title="Configuración para $selected_component" \ - --field="Usuario administrador":TEXT \ - --field="Contraseña":H \ - --field="Tag del contenedor":TEXT \ - "ogadmin" "" "latest" \ - --width=400 --height=200 --center) - user=$(echo "$config" | cut -d '|' -f 1) - password=$(echo "$config" | cut -d '|' -f 2) - container_tag=$(echo "$config" | cut -d '|' -f 3) - echo "{\"username\": \"$user\", \"password\": \"$password\", \"container_version\": \"$container_tag\" }" > $CONFIGS_DIR/"$config_file" - ;; - "ogGui") - config=$(yad --form --title="Configuración para $selected_component" \ - --field="IP del servidor de ogCore" \ - --field="Tag del contenedor":TEXT \ - --width=400 --height=200 --center) - ogcore_ip=$(echo "$config" | cut -d '|' -f 1) - container_version=$(echo "$config" | cut -d '|' -f 2) - echo "{\"ogcore_ip\": \"$ogcore_ip\" , \"container_version\": \"$container_version\" }" > $CONFIGS_DIR/"$config_file" - ;; - "ogDhcp") - config=$(yad --form --title="Configuración para $selected_component" \ - --field="Configuración IP servidor de Boot" \ - --field="Interfaces Boot" \ - --width=400 --height=200 --center) - ogbootIP=$(echo "$config" | cut -d '|' -f 1) - interfaces=$(echo "$config" | cut -d '|' -f 2) - json_array_interfaces=$(echo "$interfaces" | jq -R 'split(",")') - echo "{\"ogbootIP\": \"$ogbootIP\", \"interfaces\": \"$json_array_interfaces\"}" > $CONFIGS_DIR/"$config_file" - ;; - "ogBoot") - config=$(yad --form --title="Configuración para $selected_component" \ - --field="ogCore Ip Server" \ - --field="ogCore Server" \ - --field="ogCore Dir" \ - --field="ogBoot GitRepo" \ - --field="ogBoot Samba User" \ - --field="ogBoot Samba Pass" \ - --width=400 --height=200 --center) - ogcore_ip=$(echo "$config" | cut -d '|' -f 1) - ogcore_server=$(echo "$config" | cut -d '|' -f 2) - ogcore_dir=$(echo "$config" | cut -d '|' -f 3) - ogboot_gitrepo=$(echo "$config" | cut -d '|' -f 4) - ogboot_samba_user=$(echo "$config" | cut -d '|' -f 5) - ogboot_samba_pass=$(echo "$config" | cut -d '|' -f 6) - echo "{\"ogcore_ip\": \"$ogcore_ip\", \"ogcore_server\": \"$ogcore_server\", \"ogcore_dir\": \"$ogcore_dir\", \"ogboot_gitrepo\": \"$ogboot_gitrepo\", \"ogboot_samba_user\": \"$ogboot_samba_user\", \"ogboot_samba_pass\": \"$ogboot_samba_pass\"}" > $CONFIGS_DIR/"$config_file" - ;; - esac - - # Verificar si los campos no están vacíos - # if [[ -z "$server_ip" || -z "$config_path" ]]; then - # yad --error --text="Debes proporcionar la IP del servidor y la ruta del fichero para $selected_component." --center - # exit 1 - # fi - - # Guardar la configuración en un archivo (cada componente tiene su archivo JSON) - config_file="./${selected_component}_config.json" - echo "{\"server_ip\": \"$server_ip\", \"config_path\": \"$config_path\"}" > "$config_file" - - # Mostrar un mensaje de éxito - yad --info --text="Configuración guardada en $config_file para $selected_component." --center - -done - - -# # Una vez se ha configurado todo, se puede proceder a la instalación de los componentes -# # Ejecutar la instalación con calamares y enviar el log a un archivo - -# #calamares > installer.log 2>&1 & disown -sudo calamares > installer.log 2>&1 From 105340b165bf4ba80470dd145a12dc8811e2d76b Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 11:54:23 +0100 Subject: [PATCH 02/10] Add ssh keys --- non_graf_installer/component-installer/ssh-keys/opengnsys | 7 +++++++ .../component-installer/ssh-keys/opengnsys.pub | 1 + 2 files changed, 8 insertions(+) create mode 100644 non_graf_installer/component-installer/ssh-keys/opengnsys create mode 100644 non_graf_installer/component-installer/ssh-keys/opengnsys.pub diff --git a/non_graf_installer/component-installer/ssh-keys/opengnsys b/non_graf_installer/component-installer/ssh-keys/opengnsys new file mode 100644 index 0000000..4514194 --- /dev/null +++ b/non_graf_installer/component-installer/ssh-keys/opengnsys @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACBs7Wbqztq5ixPGFL+1DlTa0T6QUBMiLq6KxZnCJ5rofQAAAJD7Xj89+14/ +PQAAAAtzc2gtZWQyNTUxOQAAACBs7Wbqztq5ixPGFL+1DlTa0T6QUBMiLq6KxZnCJ5rofQ +AAAEC4UmYDisgl5jNR6SUwRA80k6Qc06cBHg1mW3+2NU6SfmztZurO2rmLE8YUv7UOVNrR +PpBQEyIurorFmcInmuh9AAAABm5vbmFtZQECAwQFBgc= +-----END OPENSSH PRIVATE KEY----- diff --git a/non_graf_installer/component-installer/ssh-keys/opengnsys.pub b/non_graf_installer/component-installer/ssh-keys/opengnsys.pub new file mode 100644 index 0000000..7edd74c --- /dev/null +++ b/non_graf_installer/component-installer/ssh-keys/opengnsys.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGztZurO2rmLE8YUv7UOVNrRPpBQEyIurorFmcInmuh9 noname From 3fe3fc9a5cc581e98120d2b11c4a8d5f7fb149e7 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 11:59:13 +0100 Subject: [PATCH 03/10] Modifying Files --- non_graf_installer/component-installer.sh | 150 ++++++++++++ .../python-installer/get_release.py | 54 +++++ .../python-installer/update_opengsys.sh | 214 ++++++++++++++++++ 3 files changed, 418 insertions(+) create mode 100644 non_graf_installer/component-installer.sh create mode 100644 non_graf_installer/python-installer/get_release.py create mode 100644 non_graf_installer/python-installer/update_opengsys.sh diff --git a/non_graf_installer/component-installer.sh b/non_graf_installer/component-installer.sh new file mode 100644 index 0000000..34819a3 --- /dev/null +++ b/non_graf_installer/component-installer.sh @@ -0,0 +1,150 @@ +#!/usr/bin/bash + +# Paso 1: Seleccionar los componentes +# Los componentes a instalar se encuentran en el directorio /tmp/opengnsys-installer-configs + +# Set configuration + +function install_docker() { + apt-get -y update + apt-get -y install ca-certificates curl + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.asc + echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get -y update + apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + systemctl enable docker +} + +function install_ogcore_docker() { +cat < /etc/systemd/system/ogcore.service +[Unit] +Description=Servicio para ejecutar Docker Compose de ogCore +After=docker.service +Requires=docker.service + +[Service] +WorkingDirectory=/opt/opengnsys/ogCore/repo/ +ExecStart=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml up +ExecStartPost=/opengnsys-installer/provision_ogcore.sh +ExecStop=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml stop +Restart=always + +[Install] +WantedBy=multi-user.target +EOF + + systemctl daemon-reload + systemctl enable --now ogcore +} + + + +function install_oggui_docker() { + # Sacar la IP del ogCore de la configuración + oggui_version=$(jq -r '.container_version' /opt/opengnsys/ogGui/installer/config.json) + # Exportar los valores como variables de entorno + ENV_DIR=/opt/opengnsys/ogGui/etc/ + ENV_FILE=$ENV_DIR/.env + + cat < /etc/systemd/system/oggui-app.service +[Unit] +Description=Servicio para contenedor Docker de OgGui +After=docker.service +Requires=docker.service + +[Service] +Restart=always +ExecStartPre=/opengnsys-installer/provision_oggui.sh +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 + +[Install] +WantedBy=multi-user.target +EOF + + systemctl daemon-reload + systemctl enable --now oggui-app + +} + + +COMPONENTS="ogCore ogGui ogDhcp ogBoot ogRepository" +CONFIGS_DIR=/opengnsys-installer/ +PAT_FILE=/opengnsys-installer/pat.txt +PAT=$(cat $PAT_FILE | tr -d '\n\r\t') + +OPENGNSYS_BASE_URL="https://$PAT@ognproject.evlt.uma.es/gitea/opengnsys" + +OGBOOT_REPO="$OPENGNSYS_BASE_URL/ogboot.git" +OGCORE_REPO="$OPENGNSYS_BASE_URL/ogcore.git" +OGDHCP_REPO="$OPENGNSYS_BASE_URL/ogdhcp.git" +OGGUI_REPO="$OPENGNSYS_BASE_URL/oggui.git" +OGREPOSITORY_REPO="$OPENGNSYS_BASE_URL/ogrepository.git" + +export GIT_SSL_NO_VERIFY=1 +echo ======================================== > /etc/issue +echo "OpenGnSys Installer" >> /etc/issue +echo "Componentes instalados:" >> /etc/issue + + + +for component in $COMPONENTS +do + config_file="config_${component}.json" + if [ -f $CONFIGS_DIR/$config_file ]; then + echo "Componente $component seleccionado, instalando configuración..." + component_dir=/opt/opengnsys/$component + mkdir -p $component_dir/installer + mkdir -p $component_dir/repo + cp $CONFIGS_DIR/$config_file /opt/opengnsys/$component/installer/config.json + + case $component in + ogCore) + echo "Instalando ogCore..." + OGCORE_BRANCH=main + container_version=$(jq -r '.container_version' /opt/opengnsys/ogCore/installer/config.json) + git clone --branch "$OGCORE_BRANCH" "$OGCORE_REPO" "$component_dir/repo" + # Copy the docker-compose-deploy.yml file to /opt/opengnsys/ogCore/etc/ + mkdir -p $component_dir/etc/ + cp $component_dir/repo/docker-compose-deploy.yml $component_dir/etc/ + sed -i "s/static/$container_version/g" $component_dir/repo/docker-compose-deploy.yml + echo - ogCore >> /etc/issue + install_docker + install_ogcore_docker + ;; + ogGui) + echo "Instalando ogGui..." + OGGUI_BRANCH=main + git clone --branch "$OGGUI_BRANCH" "$OGGUI_REPO" "$component_dir/repo" + echo - ogGui >> /etc/issue + install_docker + install_oggui_docker + ;; + ogDhcp) + echo "Instalando ogDhcp..." + git clone "$OGDHCP_REPO" "$component_dir/repo" + echo - ogDhcp >> /etc/issue + ;; + ogBoot) + echo "Instalando ogBoot..." + git clone "$OGBOOT_REPO" "$component_dir/repo" + echo - ogBoot >> /etc/issue + ;; + ogRepository) + echo "Instalando ogRepository..." + git clone "$OGREPOSITORY_REPO" "$component_dir/repo" + echo - ogRepository >> /etc/issue + ;; + *) + echo "Componente $component no reconocido" + ;; + esac + continue + fi +done + +echo ======================================== >> /etc/issue +rm -f $PAT_FILE diff --git a/non_graf_installer/python-installer/get_release.py b/non_graf_installer/python-installer/get_release.py new file mode 100644 index 0000000..2a39b5b --- /dev/null +++ b/non_graf_installer/python-installer/get_release.py @@ -0,0 +1,54 @@ +import os +from git import Repo +from packaging.version import Version + +def get_highest_remote_tag(repo_path): + try: + # Abre el repositorio local + repo = Repo(repo_path) + + # Asegúrate de que el repositorio tiene un remoto + if not repo.remotes: + return None # No hay remotos configurados + + # Obtén el remoto por defecto (origin o el primero disponible) + remote = repo.remotes.origin + + # Recupera los tags remotos + remote.fetch(tags=True) + remote_tags = [ref.name.split('/')[-1] for ref in repo.references if ref.path.startswith('refs/tags/')] + if not remote_tags: + return None # No hay tags remotos + + # Ordena los tags remotos por versión + tags_sorted = sorted(remote_tags, key=lambda t: Version(t) if t.replace('.', '').isdigit() else Version('0.0.0'), reverse=True) + return tags_sorted[0] if tags_sorted else None + + except Exception as e: + print(f"Error al procesar el repositorio {repo_path}: {e}") + return None + +def process_selected_repositories(base_path, repo_names): + repo_highest_tags = {} + for repo_name in repo_names: + repo_path = os.path.join(base_path, repo_name) + if os.path.exists(repo_path) and os.path.isdir(os.path.join(repo_path, '.git')): + highest_tag = get_highest_remote_tag(repo_path) + repo_highest_tags[repo_name] = highest_tag + else: + repo_highest_tags[repo_name] = "No es un repositorio Git válido" + return repo_highest_tags + +# Ruta base donde están los repositorios locales +base_path = "../" + +# Lista de nombres de repositorios específicos +repo_names = [ "ogcore" , "oggui" , "ogboot" , "ogdhcp" , "ogrepository" ] + +result = process_selected_repositories(base_path, repo_names) + +# Muestra los resultados +for repo_name, tag in result.items(): + print(f'{repo_name}:{tag}') + + diff --git a/non_graf_installer/python-installer/update_opengsys.sh b/non_graf_installer/python-installer/update_opengsys.sh new file mode 100644 index 0000000..ab9d632 --- /dev/null +++ b/non_graf_installer/python-installer/update_opengsys.sh @@ -0,0 +1,214 @@ +#!/bin/bash + +# Detect installed components. + + +INSTALLER_BRANCH=${INSTALLER_BRANCH:-main} +OPENGNSYS_BASE=/opt/opengnsys +OPENGNSYS_COMPONENTS=(ogCore ogGui ogDhcp ogBoot ogRepository) +GIT_SSL_NO_VERIFY=1 +INSTALLED_COMPONENTS=() + +GIT_REPO="https://ognproject.evlt.uma.es/gitea/api/v1/repos/opengnsys/oginstaller/archive/$INSTALLER_BRANCH.zip" + +export GIT_SSL_NO_VERIFY +INSTALLED_COMPONENTS=() + +check_os(){ + if [ -f /etc/os-release ]; then + . /etc/os-release + # Just support Ubuntu 24.04 for now + if [ $ID == "ubuntu" ] && [ $VERSION_ID == "24.04" ]; then + echo "OS supported." + else + echo "OS not supported." + exit 1 + fi + else + echo "OS not supported." + exit 1 + fi +} + +detect_installed_components() { + local OGNODE=0 + for component in "${OPENGNSYS_COMPONENTS[@]}"; do + if [ -f "${OPENGNSYS_BASE}/${component}/installer/config.json" ]; then + echo "Component $component is installed." + INSTALLED_COMPONENTS+=($component) + OGNODE=1 + else + echo "Component $component is not installed." + fi + done + if [ $OGNODE -eq 0 ]; then + echo "No OpenGnsys components installed." + else + echo "Installed components:" "${INSTALLED_COMPONENTS[@]}" + fi +} + + +# Assume taht all components are at the same release version, get the first installed compoenent and return its version +get_og_installed_version() { + local component=$1 + local version=$(jq -r '.release' ${OPENGNSYS_BASE}/${component}/installer/config.json) + echo $version +} + +start_stop_component() { + local component=$1 + local action=$2 + case $component in + ogCore) + handle_ogcore $action + ;; + ogGui) + handle_oggui $action + ;; + ogDhcp) + handle_ogdhcp $action + ;; + ogBoot) + handle_ogboot $action + ;; + ogRepository) + handle_ogrepository $action + ;; + *) + echo "Component $component not found." + ;; + esac +} + + +stop_installed_services() { + echo "Stopping services..." + for component in "${INSTALLED_COMPONENTS[@]}"; do + echo "Stopping component $component..." + start_stop_component $component stop + done +} + +start_installed_services() { + echo "Starting services..." + for component in "${INSTALLED_COMPONENTS[@]}"; do + echo "Starting component $component..." + start_stop_component $component start + done +} + +handle_ogboot() { + case $1 in + stop) + echo "Stopping ogBoot..." + systemctl stop nginx + systemctl stop tftpd-hpa + systemctl stop smbd + systemctl stop nmbd + ;; + start) + echo "Starting ogBoot..." + systemctl start nginx + systemctl start tftpd-hpa + systemctl start smbd + systemctl start nmbd + ;; + *) + echo "Invalid action." + ;; + esac +} + +handle_ogdhcp() { + case $1 in + stop) + echo "Stopping ogDhcp..." + systemctl stop kea-dhcp4-server + systemctl stop kea-ctrl-agent + ;; + start) + echo "Starting ogDhcp..." + systemctl start kea-dhcp4-server + systemctl start kea-ctrl-agent + ;; + *) + echo "Invalid action." + ;; + esac +} + +handle_ogrepository() { + case $1 in + stop) + echo "Stopping ogRepository..." + systemctl stop smbd + systemctl stop nmbd + systemctl stop ogrepo-api + ;; + start) + echo "Starting ogRepository..." + systemctl start smbd + systemctl start nmbd + systemctl start ogrepo-api + ;; + *) + echo "Invalid action." + ;; + esac +} + +handle_ogcore() { + case $1 in + stop) + echo "Stopping ogCore..." + systemctl stop ogcore + ;; + start) + echo "Starting ogCore..." + systemctl start ogcore + ;; + *) + echo "Invalid action." + ;; + esac +} + +handle_oggui() { + case $1 in + stop) + echo "Stopping ogGui..." + systemctl stop oggui-app + ;; + start) + echo "Starting ogGui..." + systemctl start oggui-app + ;; + *) + echo "Invalid action." + ;; + esac +} + + +update_installed_components() { + local version=$1 + echo "Updating components to version $version..." + for component in "${INSTALLED_COMPONENTS[@]}"; do + echo "Updating component $component..." + update_component $component $version + done +} + + +#### Main + +check_os +detect_installed_components +installed_version=$(get_og_installed_version "${INSTALLED_COMPONENTS[0]}") +select_version_to_update +stop_installed_services +update_installed_components $installed_version +start_installed_services + + From 20a338a0d66cc50475b7e5ad987a41d85c087bed Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 12:05:43 +0100 Subject: [PATCH 04/10] Fixing env.json permissions --- non_graf_installer/component-installer/provision_ogcore.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/non_graf_installer/component-installer/provision_ogcore.sh b/non_graf_installer/component-installer/provision_ogcore.sh index 8e7cd18..3d9c06a 100644 --- a/non_graf_installer/component-installer/provision_ogcore.sh +++ b/non_graf_installer/component-installer/provision_ogcore.sh @@ -48,5 +48,7 @@ curl -k -L --location 'https://localhost:8443/users' \ --header "Authorization: Bearer $bearer" \ --data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }" +chown 82:82 /opt/opengnsys/ogCore/etc/env.json + touch /opt/opengnsys/ogCore/installer/.deployed exit 0 From 4634061f41eedb6bcfc8e646dd0c208ed0e8606c Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 12:09:46 +0100 Subject: [PATCH 05/10] Fix env.json owner 82 82 to allow changes in container --- non_graf_installer/component-installer/component-installer.sh | 2 +- non_graf_installer/component-installer/provision_ogcore.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/non_graf_installer/component-installer/component-installer.sh b/non_graf_installer/component-installer/component-installer.sh index 54a3125..28298d8 100644 --- a/non_graf_installer/component-installer/component-installer.sh +++ b/non_graf_installer/component-installer/component-installer.sh @@ -123,7 +123,7 @@ do mkdir -p $component_dir/etc cp $component_dir/repo/.env $component_dir/etc/ cp $component_dir/repo/env.json $component_dir/etc/ - mkdir -p $component_dir/etc/ + chown 82:82 $component_dir/etc/ mkdir -p $component_dir/bin/ cp $CONFIGS_DIR/provision_ogcore.sh $component_dir/bin/ chmod 755 $component_dir/bin/provision_ogcore.sh diff --git a/non_graf_installer/component-installer/provision_ogcore.sh b/non_graf_installer/component-installer/provision_ogcore.sh index 3d9c06a..208f1de 100644 --- a/non_graf_installer/component-installer/provision_ogcore.sh +++ b/non_graf_installer/component-installer/provision_ogcore.sh @@ -48,7 +48,6 @@ curl -k -L --location 'https://localhost:8443/users' \ --header "Authorization: Bearer $bearer" \ --data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }" -chown 82:82 /opt/opengnsys/ogCore/etc/env.json touch /opt/opengnsys/ogCore/installer/.deployed exit 0 From 22650060afc3ea48baf7bf92513064bce3c6f288 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 12:11:41 +0100 Subject: [PATCH 06/10] Ensure download repo to exist --- .../component-installer/provision_ogcore.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/non_graf_installer/component-installer/provision_ogcore.sh b/non_graf_installer/component-installer/provision_ogcore.sh index 208f1de..70ebd92 100644 --- a/non_graf_installer/component-installer/provision_ogcore.sh +++ b/non_graf_installer/component-installer/provision_ogcore.sh @@ -3,14 +3,8 @@ set -x CONF_DIR=/opt/opengnsys/ogCore/etc/ -cd /opt/opengnsys/ogCore/repo/ +cd /opt/opengnsys/ogCore/repo/ || exit -# Preparar el fichero .yaml -# CONF_DIR=/opt/opengnsys/ogCore/etc/ -# mkdir -p $CONF_DIR - -# Copiar el fichero de configuración a CONF_DIR -# cp docker-compose-deploy.yml $CONF_DIR/ if [ -f /opt/opengnsys/ogCore/installer/.deployed ]; then echo "ogCore ya instalado" From 3344157d6b665274984a4f6c57e3b6a75409058e Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 12:22:09 +0100 Subject: [PATCH 07/10] Deploy ssh keys to repo --- .../component-installer/provision_ogrepository.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/non_graf_installer/component-installer/provision_ogrepository.sh b/non_graf_installer/component-installer/provision_ogrepository.sh index a477931..8612dac 100644 --- a/non_graf_installer/component-installer/provision_ogrepository.sh +++ b/non_graf_installer/component-installer/provision_ogrepository.sh @@ -37,10 +37,20 @@ add_user_ogrepository() { echo "User ogrepository does not exist, creating it" useradd -m -d $OGUSER_HOME -r -s /bin/bash $OGUSER fi + if [ ! -d $OGUSER_HOME/.ssh ] ; then + mkdir -p $OGUSER_HOME/.ssh + cp ssh-keys/opengnsys $OGUSER_HOME/.ssh/id_ed25519 + cp ssh-keys/opengnsys.pub $OGUSER_HOME/.ssh/id_ed25519.pub + cat ssh-keys/opengnsys.pub >> $OGUSER_HOME/.ssh/authorized_keys + chown -R $OGUSER:$OGUSER $OGUSER_HOME/.ssh + chmod 0600 $OGUSER_HOME/.ssh/* + + fi if [ ! -f /etc/sudoers.d/$OGUSER ]; then echo "User $OGUSER does not have sudo permissions, adding it" echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER" fi + } From c38fe4e26f61a063b4586f7fd8f28425a4dc9486 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 12:44:47 +0100 Subject: [PATCH 08/10] Adjust paths for oginstaller --- non_graf_installer/python-installer/opengnsys_installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/non_graf_installer/python-installer/opengnsys_installer.sh b/non_graf_installer/python-installer/opengnsys_installer.sh index c228988..b38aa94 100755 --- a/non_graf_installer/python-installer/opengnsys_installer.sh +++ b/non_graf_installer/python-installer/opengnsys_installer.sh @@ -37,8 +37,8 @@ download_installer() { extract_installer() { rm -rf /tmp/oginstall mkdir -p /tmp/oginstall - cp -r /tmp/oginstaller-$BRANCH/python-installer/* /tmp/oginstall/ - cp -r /tmp/oginstaller-$BRANCH/component-installer/* /tmp/oginstall/ + cp -r /tmp/oginstaller-$BRANCH/non_graf_installer/python-installer/* /tmp/oginstall/ + cp -r /tmp/oginstaller-$BRANCH/non_graf_installer/component-installer/* /tmp/oginstall/ chmod 755 /tmp/oginstall/*.sh chmod 755 /tmp/oginstall/*.py } From b717e2b7ee921f542cbb48a5827ecdbb5189e9fc Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 12:52:00 +0100 Subject: [PATCH 09/10] Modifying ssh keys --- .../component-installer/provision_ogrepository.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/non_graf_installer/component-installer/provision_ogrepository.sh b/non_graf_installer/component-installer/provision_ogrepository.sh index 8612dac..6f94c2f 100644 --- a/non_graf_installer/component-installer/provision_ogrepository.sh +++ b/non_graf_installer/component-installer/provision_ogrepository.sh @@ -39,9 +39,9 @@ add_user_ogrepository() { fi if [ ! -d $OGUSER_HOME/.ssh ] ; then mkdir -p $OGUSER_HOME/.ssh - cp ssh-keys/opengnsys $OGUSER_HOME/.ssh/id_ed25519 - cp ssh-keys/opengnsys.pub $OGUSER_HOME/.ssh/id_ed25519.pub - cat ssh-keys/opengnsys.pub >> $OGUSER_HOME/.ssh/authorized_keys + cp /tmp/oginstall/ssh-keys/opengnsys $OGUSER_HOME/.ssh/id_ed25519 + cp /tmp/oginstall/ssh-keys/opengnsys.pub $OGUSER_HOME/.ssh/id_ed25519.pub + cat /tmp/oginstall/ssh-keys/opengnsys.pub >> $OGUSER_HOME/.ssh/authorized_keys chown -R $OGUSER:$OGUSER $OGUSER_HOME/.ssh chmod 0600 $OGUSER_HOME/.ssh/* From 8a634a5f7192aff0d013192637adae47bec6833d Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Thu, 6 Feb 2025 14:18:41 +0100 Subject: [PATCH 10/10] Create opngsys user by installer Set permissions to env.json --- .../component-installer/component-installer.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/non_graf_installer/component-installer/component-installer.sh b/non_graf_installer/component-installer/component-installer.sh index 28298d8..08ef618 100644 --- a/non_graf_installer/component-installer/component-installer.sh +++ b/non_graf_installer/component-installer/component-installer.sh @@ -21,6 +21,10 @@ OGREPOSITORY_REPO="$OPENGNSYS_BASE_URL/ogrepository.git" export GIT_SSL_NO_VERIFY=1 +# Creamos el usuario opengnsys + +useradd -m -d /opt/opengnsys -r -s /bin/bash opengnsys + ## Functions function install_docker() { @@ -123,7 +127,7 @@ do mkdir -p $component_dir/etc cp $component_dir/repo/.env $component_dir/etc/ cp $component_dir/repo/env.json $component_dir/etc/ - chown 82:82 $component_dir/etc/ + chown 82:82 $component_dir/etc/env.json mkdir -p $component_dir/bin/ cp $CONFIGS_DIR/provision_ogcore.sh $component_dir/bin/ chmod 755 $component_dir/bin/provision_ogcore.sh