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..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 @@ -298,7 +301,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 @@ -401,6 +404,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..." @@ -751,13 +832,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 @@ -791,6 +865,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