From 953594a30abd60bf0b3bd833bcd81efbb0fd5d85 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Thu, 1 Oct 2020 14:42:44 +0200 Subject: #993 Fix oglivedir parse in setclientmode script This awk expressions is parsing a key1=value1 key2=value2... expression. For example one of the 'awk' in this patch looks for the key "oglivedir" and parses the value of that key correctly. --- server/bin/setclientmode | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/bin/setclientmode b/server/bin/setclientmode index 02c47464..65d7fe69 100755 --- a/server/bin/setclientmode +++ b/server/bin/setclientmode @@ -40,7 +40,7 @@ source $1 || exit 1 [ "$*" == "help" ] && help [ "$*" == "version" ] && version # Comprobar si el usuario es "root" o el del servicio web. -WEBUSER=$(ps axho user,comm|awk '!/root/ && /httpd|apache/ {print $TEMPLATE_NAME; exit;}') +WEBUSER=$(ps axho user,comm|awk '!/root/ && /httpd|apache/ {print $1; exit;}') CALLER=$(getcaller) [ "$USER" != "root" -a "$USER" != "$WEBUSER" -a "$CALLER" != "ogserver" ] && raiseError access "Need to be root (or webserver user)" TEMPLATE[0]="${PXEDIR[0]}/templates/${MODE_FILE}" @@ -78,10 +78,10 @@ for MAC in $ETHERNET; do DATOS=$(echo ${DATOS// /} | tr 'áéíóúñçÁÉÍÓÚÑÇ' 'aeiouncAEIOUNC') [[ "$DATOS" =~ (vga|video) ]] || DATOS="$DATOS vga=788" # Obtener directorio ogLive a partir de los datos. - OGLIVEDIR=$(echo "$DATOS" | awk -F= 'BEGIN {RS=" "} $TEMPLATE_NAME=="oglivedir" {print $2}') + OGLIVEDIR=$(echo "$DATOS" | awk -F= 'BEGIN {RS=" "} $1=="oglivedir" {print $2}') # Pondremos como propietario al usuario y grupo de Apache para que se pueda cambiar desde la consola web. - WEBGROUP=$(ps axho group,comm|awk '!/root/ && /httpd|apache/ {print $TEMPLATE_NAME; exit;}') + WEBGROUP=$(ps axho group,comm|awk '!/root/ && /httpd|apache/ {print $1; exit;}') for BOOTTYPE in 0 1; do # Si no existe la plantilla borramos el archivo PXE anterior continuamos if [ -z "${TEMPLATE[$BOOTTYPE]}" ]; then -- cgit v1.2.3-18-g5258