Merge pull request 'ogrepo-keys' (#2) from ogrepo-keys into main
oginstaller/pipeline/head There was a failure building this commit
Details
Reviewed-on: #2main
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
@ -21,6 +21,10 @@ OGREPOSITORY_REPO="$OPENGNSYS_BASE_URL/ogrepository.git"
|
||||||
export GIT_SSL_NO_VERIFY=1
|
export GIT_SSL_NO_VERIFY=1
|
||||||
|
|
||||||
|
|
||||||
|
# Creamos el usuario opengnsys
|
||||||
|
|
||||||
|
useradd -m -d /opt/opengnsys -r -s /bin/bash opengnsys
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
function install_docker() {
|
function install_docker() {
|
||||||
|
@ -123,7 +127,7 @@ do
|
||||||
mkdir -p $component_dir/etc
|
mkdir -p $component_dir/etc
|
||||||
cp $component_dir/repo/.env $component_dir/etc/
|
cp $component_dir/repo/.env $component_dir/etc/
|
||||||
cp $component_dir/repo/env.json $component_dir/etc/
|
cp $component_dir/repo/env.json $component_dir/etc/
|
||||||
mkdir -p $component_dir/etc/
|
chown 82:82 $component_dir/etc/env.json
|
||||||
mkdir -p $component_dir/bin/
|
mkdir -p $component_dir/bin/
|
||||||
cp $CONFIGS_DIR/provision_ogcore.sh $component_dir/bin/
|
cp $CONFIGS_DIR/provision_ogcore.sh $component_dir/bin/
|
||||||
chmod 755 $component_dir/bin/provision_ogcore.sh
|
chmod 755 $component_dir/bin/provision_ogcore.sh
|
|
@ -3,14 +3,8 @@
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
CONF_DIR=/opt/opengnsys/ogCore/etc/
|
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
|
if [ -f /opt/opengnsys/ogCore/installer/.deployed ]; then
|
||||||
echo "ogCore ya instalado"
|
echo "ogCore ya instalado"
|
||||||
|
@ -48,5 +42,6 @@ curl -k -L --location 'https://localhost:8443/users' \
|
||||||
--header "Authorization: Bearer $bearer" \
|
--header "Authorization: Bearer $bearer" \
|
||||||
--data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"
|
--data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"
|
||||||
|
|
||||||
|
|
||||||
touch /opt/opengnsys/ogCore/installer/.deployed
|
touch /opt/opengnsys/ogCore/installer/.deployed
|
||||||
exit 0
|
exit 0
|
|
@ -10,6 +10,7 @@ OGPASS=${4:-"og"}
|
||||||
INSTALL_DIR=/opt/opengnsys/ogrepository
|
INSTALL_DIR=/opt/opengnsys/ogrepository
|
||||||
DOWNLOAD_DIR=${5:-"/tmp/ogrepository"}
|
DOWNLOAD_DIR=${5:-"/tmp/ogrepository"}
|
||||||
DEBIAN_FRONTEND=noninteractive
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
OGUSER_HOME=/opt/opengnsys
|
||||||
export DEBIAN_FRONTEND
|
export DEBIAN_FRONTEND
|
||||||
export GIT_SSL_NO_VERIFY
|
export GIT_SSL_NO_VERIFY
|
||||||
|
|
||||||
|
@ -34,13 +35,23 @@ install_updcast () {
|
||||||
add_user_ogrepository() {
|
add_user_ogrepository() {
|
||||||
if ! id "$OGUSER" &>/dev/null; then
|
if ! id "$OGUSER" &>/dev/null; then
|
||||||
echo "User ogrepository does not exist, creating it"
|
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 [ ! -d $OGUSER_HOME/.ssh ] ; then
|
||||||
|
mkdir -p $OGUSER_HOME/.ssh
|
||||||
|
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/*
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if [ ! -f /etc/sudoers.d/$OGUSER ]; then
|
if [ ! -f /etc/sudoers.d/$OGUSER ]; then
|
||||||
echo "User $OGUSER does not have sudo permissions, adding it"
|
echo "User $OGUSER does not have sudo permissions, adding it"
|
||||||
echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER"
|
echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_directories() {
|
create_directories() {
|
|
@ -0,0 +1,7 @@
|
||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||||
|
QyNTUxOQAAACBs7Wbqztq5ixPGFL+1DlTa0T6QUBMiLq6KxZnCJ5rofQAAAJD7Xj89+14/
|
||||||
|
PQAAAAtzc2gtZWQyNTUxOQAAACBs7Wbqztq5ixPGFL+1DlTa0T6QUBMiLq6KxZnCJ5rofQ
|
||||||
|
AAAEC4UmYDisgl5jNR6SUwRA80k6Qc06cBHg1mW3+2NU6SfmztZurO2rmLE8YUv7UOVNrR
|
||||||
|
PpBQEyIurorFmcInmuh9AAAABm5vbmFtZQECAwQFBgc=
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
|
@ -0,0 +1 @@
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGztZurO2rmLE8YUv7UOVNrRPpBQEyIurorFmcInmuh9 noname
|
|
@ -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}')
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ download_installer() {
|
||||||
extract_installer() {
|
extract_installer() {
|
||||||
rm -rf /tmp/oginstall
|
rm -rf /tmp/oginstall
|
||||||
mkdir -p /tmp/oginstall
|
mkdir -p /tmp/oginstall
|
||||||
cp -r /tmp/oginstaller-$BRANCH/python-installer/* /tmp/oginstall/
|
cp -r /tmp/oginstaller-$BRANCH/non_graf_installer/python-installer/* /tmp/oginstall/
|
||||||
cp -r /tmp/oginstaller-$BRANCH/component-installer/* /tmp/oginstall/
|
cp -r /tmp/oginstaller-$BRANCH/non_graf_installer/component-installer/* /tmp/oginstall/
|
||||||
chmod 755 /tmp/oginstall/*.sh
|
chmod 755 /tmp/oginstall/*.sh
|
||||||
chmod 755 /tmp/oginstall/*.py
|
chmod 755 /tmp/oginstall/*.py
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
|