oginstaller/component-installer.sh

74 lines
2.4 KiB
Bash

#!/usr/bin/bash
# Paso 1: Seleccionar los componentes
# Los componentes a instalar se encuentran en el directorio /tmp/opengnsys-installer-configs
# Set configuration
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/oggui.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..."
git clone "$OGCORE_REPO" "$component_dir/repo"
echo - ogCore >> /etc/issue
;;
ogGui)
echo "Instalando ogGui..."
git clone "$OGGUI_REPO" "$component_dir/repo"
echo - ogGui >> /etc/issue
;;
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