From e62a55ae37bfdb2aba86696dde5bc27555dd5cf8 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 15 Jul 2024 16:38:07 +0200 Subject: src: port setclientmode code to C Implement most of the code from the script setclientmode into ogServer to improve error handling and logs. Use a reduced version legacy script to replace the contents of the base PXE template. This file is now called updategrubprofile. Add updategrubprofile to the new extras/ folder. Create BIOS and UEFI files for PXE boot configuration. Each file is located in a different directory and requires a different name pattern. -BIOS- File format: /opt/opengnsys/tftpboot/menu.lst/01-XX-XX-XX-XX-XX-XX Template dir: /opt/opengnsys/tftpboot/menu.lst/templates/ -UEFI- File format: /opt/opengnsys/tftpboot/grub/01-xx:xx:xx:xx:xx:xx Template dir: /opt/opengnsys/tftpboot/grub/templates/ --- extras/updategrubprofile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 extras/updategrubprofile (limited to 'extras/updategrubprofile') diff --git a/extras/updategrubprofile b/extras/updategrubprofile new file mode 100644 index 0000000..f2c83e2 --- /dev/null +++ b/extras/updategrubprofile @@ -0,0 +1,14 @@ +#!/bin/bash + +[ $# -gt 1 ] && exit 1 +source "$1" || exit 1 + +# Obtener directorio ogLive a partir de los datos. +OGLIVEDIR=$(echo "$DATA" | awk -F= 'BEGIN {RS=" "} $1=="oglivedir" {print $2}') + +# Elimina "oglivedir" de los parametros si ya esta en la plantilla. +if grep -q "oglivedir=" ${TEMPLATE_PATH} 2>/dev/null; then + DATA="${DATA/oglivedir=$OGLIVEDIR/}" +fi + +sed -e "s,vga=[0-9]*,,g; s,INFOHOST,${DATA//,/\\,},g; s,set ISODIR=.*,set ISODIR=$OGLIVEDIR,g" ${TEMPLATE_PATH} >${PXEFILE_PATH} -- cgit v1.2.3-18-g5258