refs #350 changes sambas variables and adds compilation functions ofr ogadmclient

ogboot_installer
qindel 2024-05-13 09:00:17 +00:00
parent 3541f0f5c8
commit e1f4a96ccf
1 changed files with 95 additions and 72 deletions

View File

@ -299,13 +299,34 @@ function createDirs() {
local path_opengnsys_base="$1"
# Crear estructura de directorios.
echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base"
mkdir -p $path_opengnsys_base
mkdir -p $path_opengnsys_base/bin
mkdir -p $path_opengnsys_base/client/{cache,images,log}
mkdir -p $path_opengnsys_base/doc
mkdir -p $path_opengnsys_base/etc
mkdir -p $path_opengnsys_base/lib
mkdir -p $path_opengnsys_base/log/clients
ln -fs $path_opengnsys_base/log /var/log/opengnsys
mkdir -p $path_opengnsys_base/sbin
mkdir -p $path_opengnsys_base/www
mkdir -p $path_opengnsys_base/images/groups
mkdir -p $TFTPCFGDIR
ln -fs $TFTPCFGDIR $path_opengnsys_base/tftpboot
mkdir -p $path_opengnsys_base/tftpboot/{menu.lst,grub}
if [ $? -ne 0 ]; then
errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
return 1
fi
# 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, tftpboot}
if [ $? -ne 0 ]; then
errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
return 1
fi
#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, tftpboot}
#if [ $? -ne 0 ]; then
# errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
# return 1
#fi
# Crear usuario ficticio.
if id -u "$OPENGNSYS_CLIENT_USER" &>/dev/null; then
@ -411,75 +432,71 @@ function copyServerFiles() {
####################################################################
# 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
#}
function servicesCompilation ()
{
local hayErrores=0
# Compilar OpenGnsys Server
echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Server"
pushd $WORKDIR/ogboot/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/ogboot/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/ogboot/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
####################################################################
### Funciones instalacion cliente opengnsys
####################################################################
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
#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
#}
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() {
@ -563,7 +580,7 @@ function smbConfigure()
backupFile $SAMBACFGDIR/smb.conf
# Copiar plantailla de recursos para OpenGnsys
sed -e "s/OGBOOTDIR/${INSTALL_OGBOOT_TARGET//\//\\/}/g" \
sed -e "s/OGBOOTDIR/${INSTALL_TARGET//\//\\/}/g" \
$WORKDIR/ogboot/etc/smb-ogboot.conf.tmpl > $SAMBACFGDIR/smb-ogboot.conf
# Configurar y recargar Samba"
perl -pi -e "s/WORKGROUP/OPENGNSYS/; s/server string \=.*/server string \= ogBoot Samba Server/" $SAMBACFGDIR/smb.conf
@ -857,6 +874,12 @@ if [ $? -ne 0 ]; then
exit 1
fi
# Compilar código fuente de los servicios de OpenGnsys.
servicesCompilation
if [ $? -ne 0 ]; then
errorAndLog "Error while compiling OpenGnsys services"
exit 1
fi
# Copiar ficheros de servicios OpenGnsys Server.
copyServerFiles ${INSTALL_TARGET}
@ -903,4 +926,4 @@ sudo apt-get update
# Ahora puedes clonar e instalar el componente ogboot
# git clone <URL del repositorio de ogboot>
# cd <directorio de ogboot>
# composer install
# composer install