summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-15 16:38:07 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-16 13:44:40 +0200
commite62a55ae37bfdb2aba86696dde5bc27555dd5cf8 (patch)
tree17e00961938d32d433429e072383684ace7c4cc8 /extras
parentdf52acba04e85191b0fc7f10b7853fe17fb25260 (diff)
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/
Diffstat (limited to 'extras')
-rw-r--r--extras/updategrubprofile14
1 files changed, 14 insertions, 0 deletions
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}