#!/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/python-installer/* /tmp/oginstall/ cp -r /tmp/oginstaller-$BRANCH/component-installer/* /tmp/oginstall/ chmod 755 /tmp/oginstall/*.sh chmod 755 /tmp/oginstall/*.py } create_questions() { echo "Creating questions..." python3 /tmp/oginstall/oginstaller-v2.py deactivate } launch_component_installer() { echo "Launching component installer..." /tmp/oginstall/component-installer.sh } 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 launch_component_installer clean_tmp