summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-10-01 14:42:44 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-10-02 11:28:52 +0200
commit953594a30abd60bf0b3bd833bcd81efbb0fd5d85 (patch)
treedb54f0513d1c8207c793c60efdd63bd854c11e21
parent67be7d8c9e7682114fc43dc88244c9374046ea47 (diff)
#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.
-rwxr-xr-xserver/bin/setclientmode6
1 files changed, 3 insertions, 3 deletions
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