From d6bfa98e3ecb1e06a5a156bce6c7b2cc40d8cf1c Mon Sep 17 00:00:00 2001 From: lgromero Date: Thu, 9 May 2024 10:16:49 +0200 Subject: [PATCH 1/4] refs #273 adds kea template --- etc/kea-dhcp4.conf.tmpl | 44 ++++++++++++++++++++ installer/ogboot_installer.sh | 78 +++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 etc/kea-dhcp4.conf.tmpl diff --git a/etc/kea-dhcp4.conf.tmpl b/etc/kea-dhcp4.conf.tmpl new file mode 100644 index 0000000..047b8ed --- /dev/null +++ b/etc/kea-dhcp4.conf.tmpl @@ -0,0 +1,44 @@ +{ + "Dhcp4": { + "interfaces-config": { + "interfaces": "INTERFACES" + }, + "subnet4": [ + { + "subnet": "192.168.2.0/24", + "option-data": [ + { + "name": "routers", + "code": 3, + "data": "192.168.2.1" + } + ], + "pools": [] + } + ], + "option-data": [ + { + "name": "domain-name-servers", + "data": "1.1.1.1,8.8.8.8" + }, + { + "name": "routers", + "data": "192.168.8.1,192.168.9.1" + } + ], + "client-classes": [ + { + "name": "UEFI-64", + "test": "not substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'", + "boot-file-name": "ipxe.efi", + "next-server": "SERVERIP" + }, + { + "name": "Legacy", + "test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'", + "boot-file-name": "undionly.kpxe", + "next-server": "SERVERIP" + } + ] + } +} diff --git a/installer/ogboot_installer.sh b/installer/ogboot_installer.sh index 5507d95..211839e 100755 --- a/installer/ogboot_installer.sh +++ b/installer/ogboot_installer.sh @@ -401,6 +401,84 @@ function copyServerFiles() { popd || return } + + +#################################################################### +### Funciones de compilación de código fuente de servicios +#################################################################### + +# Compilar los servicios de OpenGnsys +#function servicesCompilation () +#{ +# local hayErrores=0 +# +# # Compilar OpenGnsys Server +# echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Server" +# pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer +# make && mv ogAdmServer $INSTALL_TARGET/sbin +# if [ $? -ne 0 ]; then +# echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server" +# hayErrores=1 +# fi +# popd +# # Compilar OpenGnsys Agent +# echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Agent" +# pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent +# make && mv ogAdmAgent $INSTALL_TARGET/sbin +# if [ $? -ne 0 ]; then +# echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Agent" +# hayErrores=1 +# fi +# popd +# # Compilar OpenGnsys Client +# echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Client" +# pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient +# make && mv ogAdmClient ../../../../client/shared/bin +# if [ $? -ne 0 ]; then +# echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Client" +# hayErrores=1 +# fi +# popd +# +# return $hayErrores +#} + + +#REVISAR SI HACE FALTA Y COMO ESTRUCTURARLO!!!!!!!################## + +#################################################################### +### Funciones instalacion cliente opengnsys +#################################################################### + +#function copyClientFiles() +#{ +# local errstatus=0 +# +# echoAndLog "${FUNCNAME}(): Copying OpenGnsys Client files." +# cp -a $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client +# if [ $? -ne 0 ]; then +# errorAndLog "${FUNCNAME}(): error while copying client estructure" +# errstatus=1 +# fi +# +# echoAndLog "${FUNCNAME}(): Copying OpenGnsys Cloning Engine files." +# mkdir -p $INSTALL_TARGET/client/lib/engine/bin +# cp -a $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin +# if [ $? -ne 0 ]; then +# errorAndLog "${FUNCNAME}(): error while copying engine files" +# errstatus=1 +# fi +# +# if [ $errstatus -eq 0 ]; then +# echoAndLog "${FUNCNAME}(): client copy files success." +# else +# errorAndLog "${FUNCNAME}(): client copy files with errors" +# fi +# +# return $errstatus +#} + + generate_ipxe_script() { echo "Generando script IPXE..." From 03924cd3b2559abce66dcfea64f07d2656e7bf69 Mon Sep 17 00:00:00 2001 From: lgromero Date: Thu, 9 May 2024 10:21:53 +0200 Subject: [PATCH 2/4] refs #273 changes kea conf order execution --- installer/ogboot_installer.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/installer/ogboot_installer.sh b/installer/ogboot_installer.sh index 211839e..b608875 100755 --- a/installer/ogboot_installer.sh +++ b/installer/ogboot_installer.sh @@ -829,13 +829,6 @@ pushd $WORKDIR checkDependencies install_kea -# Configuración ejemplo DHCP. -keaDhcpConfigure -if [ $? -ne 0 ]; then - errorAndLog "Error while copying your dhcp server files!" - exit 1 -fi - # Si es necesario, descarga el repositorio de código en directorio temporal if [ $REMOTE -eq 1 ]; then @@ -869,6 +862,13 @@ if [ $? -ne 0 ]; then exit 1 fi +# Configuración ejemplo DHCP. +keaDhcpConfigure +if [ $? -ne 0 ]; then + errorAndLog "Error while copying your dhcp server files!" + exit 1 +fi + # Configuración de TFTP. tftpConfigure From 0cda6118e05afb44756737eab007e5b522ee5dab Mon Sep 17 00:00:00 2001 From: lgromero Date: Thu, 9 May 2024 10:26:31 +0200 Subject: [PATCH 3/4] refs #273 adds tftpboot directory creation --- installer/ogboot_installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/ogboot_installer.sh b/installer/ogboot_installer.sh index b608875..58df485 100755 --- a/installer/ogboot_installer.sh +++ b/installer/ogboot_installer.sh @@ -298,7 +298,7 @@ function createDirs() { # Crear estructura de directorios. echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base" - mkdir -p "$path_opengnsys_base"/{bin,config,docs,public,src,etc/kea/backup,templates,var/{cache,log},vendor} + mkdir -p "$path_opengnsys_base"/{bin,config,docs,public,src,etc/kea/backup,templates,var/{cache,log},vendor, tftpboot} if [ $? -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?" return 1 From 92eb279baa2f0f8d1fa1ad03da20f78aabed5ad8 Mon Sep 17 00:00:00 2001 From: lgromero Date: Thu, 9 May 2024 10:37:38 +0200 Subject: [PATCH 4/4] refs #273 adds xinetd variables and configuration for tftp functions --- installer/ogboot_installer.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/installer/ogboot_installer.sh b/installer/ogboot_installer.sh index 58df485..e0d8c86 100755 --- a/installer/ogboot_installer.sh +++ b/installer/ogboot_installer.sh @@ -58,6 +58,9 @@ function globalSetup() { SAMBASERV=smbd SAMBACFGDIR=/etc/samba TFTPCFGDIR=/var/lib/tftpboot + TFTPSERV=tftp + INETDSERV=xinetd + INETDCFGDIR=/etc/xinetd.d PHPFPMSERV=php7.2-fpm