v1.2.0
Line | |
---|
1 | #!/bin/bash |
---|
2 | # #/** |
---|
3 | # setBootMode |
---|
4 | #@brief Script to configure the PXE mode to client |
---|
5 | #@param 1 template |
---|
6 | #@date 2012-02-2-9 |
---|
7 | #@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 |
---|
8 | #@author Juan Carlos Garcia - Univ. Zaragoza |
---|
9 | #@date 2015-11-17 |
---|
10 | #*/ ## |
---|
11 | |
---|
12 | #REPOIP="$(ogGetRepoIp)" |
---|
13 | |
---|
14 | # Asignamos la IP del servidor de administracion que es el destino del script |
---|
15 | SERVERIP="$(ogGetServerIp)" |
---|
16 | PORT=2011 |
---|
17 | TEMPLATE=$(grep -l "^#.* $1 *$" /opt/oglive/tftpboot/menu.lst/templates/*) |
---|
18 | PCNAME="$(hostname)" |
---|
19 | |
---|
20 | PROG="$(basename $0)" |
---|
21 | if [ "$*" == "help" ]; then |
---|
22 | ogHelp "$PROG" "$PROG template [ 0 | 1 ] (0 - Temporary 1, - Permanent) " \ |
---|
23 | "$PROG ogLive 1" \ |
---|
24 | "$PROG 1hd-1partition 0" |
---|
25 | exit |
---|
26 | fi |
---|
27 | |
---|
28 | |
---|
29 | # Control básico de errores. |
---|
30 | if [ $# -ne 2 ]; then |
---|
31 | ogRaiseError $OG_ERR_FORMAT "$MSG_ERR_FORMAT: $PROG TEMPLATE_NAME [ 0 | 1 ] (0 - Temporary, 1 - Permanent)" |
---|
32 | exit $? |
---|
33 | fi |
---|
34 | |
---|
35 | if [ -z "$TEMPLATE" ]; then |
---|
36 | ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_NOTFOUND: $1" |
---|
37 | exit $? |
---|
38 | fi |
---|
39 | |
---|
40 | if [ $2 != "0" ] && [ $2 != "1" ]; then |
---|
41 | ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_FORMAT: modo $2 no existe" |
---|
42 | exit $? |
---|
43 | fi |
---|
44 | # 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) |
---|
45 | hose $SERVERIP $PORT --out sh -c "echo -ne SET_CLIENTMODE $1 $PCNAME $2" |
---|
46 | |
---|
47 | |
---|
Note: See
TracBrowser
for help on using the repository browser.