summaryrefslogtreecommitdiffstats
path: root/client/shared/scripts/setBootMode
diff options
context:
space:
mode:
Diffstat (limited to 'client/shared/scripts/setBootMode')
-rwxr-xr-xclient/shared/scripts/setBootMode32
1 files changed, 22 insertions, 10 deletions
diff --git a/client/shared/scripts/setBootMode b/client/shared/scripts/setBootMode
index 4ab9c816..81eec28c 100755
--- a/client/shared/scripts/setBootMode
+++ b/client/shared/scripts/setBootMode
@@ -4,32 +4,44 @@
#@brief Script to configure the PXE mode to client
#@param 1 template
#@date 2012-02-2-9
+#@version 1.0.1 - Recoge como parametro el nombre interno de la plantilla en vez del nombre de fichero para que funcione correctamente al llamar a setclientmode y anade un nuevo parametro de modo de trabajo (0 o 1) que indica que el cambio del fichero PXE del servidor sera temporal o permanente
+#@author Juan Carlos Garcia - Univ. Zaragoza
+#@date 2015-11-17
#*/ ##
-REPOIP="$(ogGetRepoIp)"
+#REPOIP="$(ogGetRepoIp)"
+
+# Asignamos la IP del servidor de administracion que es el destino del script
+SERVERIP="$(ogGetServerIp)"
PORT=2011
-TEMPLATE="/opt/oglive/tftpboot/menu.lst/templates/$1"
+TEMPLATE=$(grep -l "^#.* $1 *$" /opt/oglive/tftpboot/menu.lst/templates/*)
PCNAME="$(hostname)"
PROG="$(basename $0)"
if [ "$*" == "help" ]; then
- ogHelp "$PROG" "$PROG template" \
- "$PROG pxe" \
- "$PROG 01"
+ ogHelp "$PROG" "$PROG template [ 0 | 1 ] (0 - Temporary 1, - Permanent) " \
+ "$PROG ogLive 1" \
+ "$PROG 1hd-1partition 0"
exit
fi
# Control básico de errores.
-if [ $# -ne 1 ]; then
- ogRaiseError $OG_ERR_FORMAT "$MSG_ERR_FORMAT: $PROG TEMPLATE_NAME"
+if [ $# -ne 2 ]; then
+ ogRaiseError $OG_ERR_FORMAT "$MSG_ERR_FORMAT: $PROG TEMPLATE_NAME [ 0 | 1 ] (0 - Temporary, 1 - Permanent)"
exit $?
fi
-if [ ! -e $TEMPLATE ]; then
- ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_NOTFOUND: $TEMPLATE"
+
+if [ -z "$TEMPLATE" ]; then
+ ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_NOTFOUND: $1"
exit $?
fi
-hose $REPOIP $PORT --out sh -c "echo -ne SET_CLIENTMODE $1 $PCNAME"
+if [ $2 != "0" ] && [ $2 != "1" ]; then
+ ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_FORMAT: modo $2 no existe"
+ exit $?
+fi
+# Crea un pipe con el servidor de administracion que llama a setclientmode pasandole los parametros de nombre de plantilla, nombre PC y modo de trabajo (0 o 1)
+hose $SERVERIP $PORT --out sh -c "echo -ne SET_CLIENTMODE $1 $PCNAME $2"