Last change
on this file since 5d05b06 was
4972d15,
checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago
|
#988 Read json config file in scripts
This patch implements the function source_json_config() that is used to
read the new ogserver.json config file in the scripts. This replaces the
old 'source .../ogserver.cfg'.
Co-authored-by: Javier Sánchez Parra <jsanchez@…>
|
-
Property mode set to
100755
|
File size:
1.4 KB
|
Rev | Line | |
---|
[61dbabb] | 1 | #!/bin/bash |
---|
[b7bed1c] | 2 | #/** |
---|
| 3 | #@file listclientmode |
---|
| 4 | #@brief Lista la plantilla de arranque PXE para los clientes, ya sea un equipo o un aula. |
---|
| 5 | #@usage listclientmode Ambito |
---|
| 6 | #@param Ambito nombre de ordenador o nombre de aula |
---|
| 7 | #@version 1.0.1 - Versión inicial. |
---|
| 8 | #@author Irina Gómez, Univ. Sevilla |
---|
| 9 | #@date 2010-11-29 |
---|
| 10 | #@version 1.0.5 - Mejor acceso a la BD. |
---|
| 11 | #@author Ramon M. Gómez, Univ. Sevilla |
---|
| 12 | #@date 2013-03-11 |
---|
| 13 | #**/ |
---|
[61dbabb] | 14 | |
---|
| 15 | |
---|
| 16 | # Variables. |
---|
| 17 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} |
---|
[4972d15] | 18 | SERVERCONF=$OPENGNSYS/etc/ogserver.json |
---|
[7710a99] | 19 | TMPLDIR=$OPENGNSYS/tftpboot/menu.lst/templates |
---|
[b7bed1c] | 20 | |
---|
| 21 | source $OPENGNSYS/lib/ogfunctions.sh || exit 1 |
---|
[61dbabb] | 22 | |
---|
| 23 | # Control básico de errores. |
---|
[b7bed1c] | 24 | [ "$*" == "help" ] && help |
---|
| 25 | [ "$*" == "version" ] && version |
---|
| 26 | [ $# -eq 1 ] || raiseError usage |
---|
| 27 | [ "$USER" != "root" ] && raiseError access "Need to be root" |
---|
[4972d15] | 28 | source_json_config $SERVERCONF 2>/dev/null || raiseError access "Sin acceso a fichero de configuración" |
---|
[61dbabb] | 29 | |
---|
[75f9c01] | 30 | # Sustituir caracteres ' por \' para evitar inyección SQL. |
---|
[b7bed1c] | 31 | RESOURCE="${1//\'/\\\'}" |
---|
[d1d41ad] | 32 | # Obtener nombre de ordenador individual o todos los de una aula e indicar su plantilla asociada. |
---|
[b7bed1c] | 33 | dbexec "SELECT nombreordenador, arranque |
---|
| 34 | FROM ordenadores |
---|
| 35 | JOIN aulas USING (idaula) |
---|
| 36 | WHERE aulas.nombreaula='$RESOURCE' |
---|
| 37 | OR nombreordenador='$RESOURCE';" | \ |
---|
| 38 | while read PC TMPL; do |
---|
| 39 | echo "Equipo \"$PC\" asociado a arranque tipo \"$(head -1 $TMPLDIR/$TMPL | cut -f2 -d" ")\" (fichero $TMPL)" |
---|
| 40 | done |
---|
[61dbabb] | 41 | |
---|
Note: See
TracBrowser
for help on using the repository browser.