summaryrefslogtreecommitdiffstats
path: root/server/bin
diff options
context:
space:
mode:
authorIrina Gómez <irinagomez@us.es>2019-12-05 11:50:09 +0100
committerIrina Gómez <irinagomez@us.es>2019-12-05 11:50:09 +0100
commit541ddee3831e38767a51d61ba1f11519f0ad452b (patch)
tree3cc32e0190d0526c36a40202418043a9e62c2772 /server/bin
parentedfcca896a9a31ada60d73fc9d4ad6f19a5060b3 (diff)
#914 #811 setclientmode: Fix error for temporary change of PXE file. Adds permission to be call from console, for example with 'Ejecutar script' .
Diffstat (limited to 'server/bin')
-rwxr-xr-xserver/bin/setclientmode7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/bin/setclientmode b/server/bin/setclientmode
index f8d5b55f..4a37f9cc 100755
--- a/server/bin/setclientmode
+++ b/server/bin/setclientmode
@@ -44,7 +44,8 @@ source $OPENGNSYS/lib/ogfunctions.sh
[ $# -ne 3 ] && raiseError usage
# Comprobar si el usuario es "root" o el del servicio web.
WEBUSER=$(ps axho user,comm|awk '!/root/ && /httpd|apache/ {print $1; exit;}')
-[ "$USER" != "root" -a "$USER" != "$WEBUSER" ] && raiseError access "Need to be root (or webserver user)"
+CALLER=$(getCaller)
+[ "$USER" != "root" -a "$USER" != "$WEBUSER" -a "$CALLER" != "ogAdmServerAux" ] && raiseError access "Need to be root (or webserver user)"
# El acceso a mysql por las variables pasadas o por el fichero de configuarción.
if [ -z "$USUARIO" ] || [ -z "$PASSWORD" ] || [ -z "$CATALOG" ]; then
[ ! -r "$SERVERCONF" ] && raiseError access "Cannot read access configuration file"
@@ -93,6 +94,10 @@ for MAC in $ETHERNET; do
PXEFILE[0]=01-${MACFILE:0:2}-${MACFILE:2:2}-${MACFILE:4:2}-${MACFILE:6:2}-${MACFILE:8:2}-${MACFILE:10:2}
MACFILE="${MAC,,}"
PXEFILE[1]=01-${MACFILE:0:2}:${MACFILE:2:2}:${MACFILE:4:2}:${MACFILE:6:2}:${MACFILE:8:2}:${MACFILE:10:2}
+ # Renombra el fichero PXE original
+ [ -e ${PXEDIR[0]}/${PXEFILE[0]} ] && mv ${PXEDIR[0]}/${PXEFILE[0]} ${PXEDIR[0]}/${PXEFILE[0]}.netboot
+ [ -e ${PXEDIR[1]}/${PXEFILE[1]} ] && mv ${PXEDIR[1]}/${PXEFILE[1]} ${PXEDIR[1]}/${PXEFILE[1]}.netboot
+
if [ "$1" != "default" ]; then
# Si no está definida la variable LANG, usar idioma inglés por defecto.
[ -z "$LANG" -o "$LANG" == "C" ] && LANG="en"