#991 Inyectar parametros de instalación recogidos por yad
- Modifica script de instalación para tratar cada componente por separado - Modifica archico de configuración de calamares para instanciar shell dos veces, una para copiar los archivos de configuración y la otra para ejecutar el script de instalación de cada componente en el chroot - Crea el directorio src para trabajar con calamares en modo -d y no tener que ejecutar el proceso competo - Crea el script de instalación que se lanzará en el chroot para instalar todos los componentesuser-story-905
parent
877e160d95
commit
91bffa83aa
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
|
||||
dontChroot: false
|
||||
verbose: true
|
||||
script:
|
||||
- /tmp/opengnsys-configs/component-installer.sh
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
|
||||
dontChroot: true
|
||||
verbose: true
|
||||
script:
|
||||
- mkdir -p ${ROOT}/tmp/opengnsys-configs
|
||||
- cp /tmp/opengnsys-installer-configs/* ${ROOT}/tmp/opengnsys-configs
|
||||
- cp /home/narenas/w/remote_fs/oginstaller/component-installer.sh ${ROOT}/tmp/opengnsys-configs
|
||||
- chmod 755 ${ROOT}/tmp/opengnsys-configs/component-installer.sh
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
|
||||
dontChroot: false
|
||||
verbose: true
|
||||
script:
|
||||
- /tmp/opengnsys-configs/component-installer.sh
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
|
||||
dontChroot: true
|
||||
verbose: true
|
||||
script:
|
||||
- mkdir -p ${ROOT}/tmp/opengnsys-configs
|
||||
- cp /tmp/opengnsys-installer-configs/* ${ROOT}/tmp/opengnsys-configs
|
||||
- cp /home/narenas/w/remote_fs/oginstaller/component-installer.sh ${ROOT}/tmp/opengnsys-configs
|
||||
- chmod 755 ${ROOT}/tmp/opengnsys-configs/component-installer.sh
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
unpack:
|
||||
- source: "/home/narenas/filesystem.ubuntu.sqfs"
|
||||
sourcefs: squashfs
|
||||
destination: "/"
|
||||
|
|
@ -4,6 +4,14 @@ modules-search:
|
|||
- local
|
||||
- /usr/lib/x86_64-linux-gnu/calamares/modules
|
||||
|
||||
instances:
|
||||
- id: shell_nonchroot
|
||||
module: shellprocess
|
||||
config: shell_nonchroot.conf
|
||||
- id: shell_chroot
|
||||
module: shellprocess
|
||||
config: shell_chroot.conf
|
||||
|
||||
sequence:
|
||||
- show:
|
||||
- welcome
|
||||
|
@ -20,6 +28,8 @@ sequence:
|
|||
- locale
|
||||
- keyboard
|
||||
- users
|
||||
- shellprocess@shell_nonchroot
|
||||
- shellprocess@shell_chroot
|
||||
- initramfs
|
||||
- bootloader
|
||||
- umount
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../modules/
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# Paso 1: Seleccionar los componentes
|
||||
# Los componentes a instalar se encuentran en el directorio /tmp/opengnsys-installer-configs
|
||||
|
||||
COMPONENTS="ogCore ogGui ogDhcp ogBoot"
|
||||
CONFIGS_DIR=/tmp/opengnsys-configs
|
||||
|
||||
for component in $COMPONENTS
|
||||
do
|
||||
config_file="config_${component}.json"
|
||||
if [ -f $CONFIGS_DIR/$config_file ]; then
|
||||
echo "Componente $component seleccionado, instalando configuración..."
|
||||
mkdir -p /opt/opengnsys/$component
|
||||
mkdir -p /opt/opengnsys/$component/installer
|
||||
cp $CONFIGS_DIR/$config_file /opt/opengnsys/$component/installer/config.json
|
||||
continue
|
||||
fi
|
||||
done
|
|
@ -1,5 +1,10 @@
|
|||
#!/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:" \
|
||||
|
@ -17,42 +22,69 @@ if [[ -z "$components" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Procesar los componentes seleccionados, eliminando la primera columna (TRUE)
|
||||
echo $components
|
||||
IFS="|" read -r -a selected_components <<< "$components"
|
||||
|
||||
for component in "${selected_components[@]}"; do
|
||||
# Extraer solo el nombre del componente (segundo campo)
|
||||
component_name=$(echo "$component" | cut -d '|' -f 2)
|
||||
|
||||
for component in $components; do
|
||||
selected_component=$(echo "$component" | cut -d '|' -f 2)
|
||||
# Pedir la configuración específica para cada componente seleccionado
|
||||
config=$(yad --form --title="Configuración para $component_name" \
|
||||
--field="IP del servidor" \
|
||||
--field="Ruta del fichero de configuración" \
|
||||
--width=400 --height=200 --center)
|
||||
|
||||
|
||||
# Dividir la configuración en IP y ruta del fichero
|
||||
server_ip=$(echo "$config" | cut -d '|' -f 1)
|
||||
config_path=$(echo "$config" | cut -d '|' -f 2)
|
||||
config_file="config_${selected_component}.json"
|
||||
case $selected_component in
|
||||
"ogCore")
|
||||
server_ip=$(echo "$config" | cut -d '|' -f 1)
|
||||
config_path=$(echo "$config" | cut -d '|' -f 2)
|
||||
;;
|
||||
"ogGui")
|
||||
server_ip=$(echo "$config" | cut -d '|' -f 1)
|
||||
config_path=$(echo "$config" | cut -d '|' -f 2)
|
||||
;;
|
||||
"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 $component_name." --center
|
||||
exit 1
|
||||
fi
|
||||
# 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="./${component_name}_config.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 $component_name." --center
|
||||
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
|
||||
# # 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
|
||||
# #calamares > installer.log 2>&1 & disown
|
||||
sudo calamares > installer.log 2>&1
|
||||
|
|
Loading…
Reference in New Issue