close
          Warning:
          Failed to sync with repository "ogBrowser-Git": (1366, "Incorrect string value: '\\xF0\\x9F\\x93\\xA6 I...' for column 'message' at row 1"); repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
      
 
    
        
        
        
        
        
          918-git-images-111dconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
        
      
      
        
  | Rev | Line |   | 
|---|
| [61dbabb] | 1 | #!/bin/bash | 
|---|
| [b5aae72] | 2 | # listclientmode: Lista la plantilla de arranque PXE para los clientes,  | 
|---|
| [61dbabb] | 3 | #       ya sea un equipo o un aula. | 
|---|
 | 4 | # Nota: Si no existe un enlace entre el fichero PXE con la Ethernet del equipo y su | 
|---|
 | 5 | #        archivo plantilla, se considera que la plantilla por omisión es "default". | 
|---|
| [b5aae72] | 6 | # Uso:  listclienmode NombrePC | NombreAula | 
|---|
| [61dbabb] | 7 | # Autores: Irina Gomez y Ramon Gomez - Univ. Sevilla, noviembre 2010 | 
|---|
 | 8 |  | 
|---|
 | 9 |  | 
|---|
 | 10 | # Variables. | 
|---|
 | 11 | PROG=$(basename $0) | 
|---|
 | 12 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} | 
|---|
 | 13 | SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg | 
|---|
| [7710a99] | 14 | TMPLDIR=$OPENGNSYS/tftpboot/menu.lst/templates | 
|---|
| [d1d41ad] | 15 | MYCNF=/tmp/.my.cnf.$$ | 
|---|
| [61dbabb] | 16 |  | 
|---|
 | 17 | # Control básico de errores. | 
|---|
 | 18 | if [ $# -ne 1 ]; then | 
|---|
 | 19 |         echo "$PROG: Error de ejecución" | 
|---|
 | 20 |         echo "Formato: $PROG [NOMBRE_PC|NOMBRE_AULA]" | 
|---|
 | 21 |         exit 1 | 
|---|
 | 22 | fi | 
|---|
 | 23 | if [ ! -r $SERVERCONF ]; then | 
|---|
 | 24 |         echo "$PROG: Sin acceso a fichero de configuración" | 
|---|
 | 25 |         exit 2 | 
|---|
 | 26 | fi | 
|---|
 | 27 |  | 
|---|
 | 28 | # Obtener datos de acceso a la Base de datos. | 
|---|
 | 29 | source $SERVERCONF | 
|---|
| [75f9c01] | 30 | # Sustituir caracteres ' por \' para evitar inyección SQL. | 
|---|
 | 31 | RESOURCE="${1//\'/\'}" | 
|---|
| [d1d41ad] | 32 | # Componer fichero con credenciales de conexión. | 
|---|
 | 33 | touch $MYCNF | 
|---|
 | 34 | chmod 600 $MYCNF | 
|---|
 | 35 | cat << EOT > $MYCNF | 
|---|
 | 36 | [client] | 
|---|
 | 37 | user=$USUARIO | 
|---|
 | 38 | password=$PASSWORD | 
|---|
 | 39 | EOT | 
|---|
 | 40 | # Borrar el fichero temporal si termina el proceso. | 
|---|
 | 41 | trap "rm -f $MYCNF" 0 1 2 3 6 9 15 | 
|---|
 | 42 | # Obtener nombre de ordenador individual o todos los de una aula e indicar su plantilla asociada. | 
|---|
| [9d380ec] | 43 | mysql --defaults-extra-file=$MYCNF -D "$CATALOG" -s -N -e \ | 
|---|
| [d1d41ad] | 44 |                 "SELECT nombreordenador, arranque FROM ordenadores | 
|---|
 | 45 |                    JOIN aulas USING (idaula) | 
|---|
 | 46 |                   WHERE aulas.nombreaula='$RESOURCE' | 
|---|
 | 47 |                      OR nombreordenador='$RESOURCE';" | \ | 
|---|
| [7710a99] | 48 |         while read PC TMPL; do | 
|---|
| [5d28f39] | 49 |                 echo "Equipo \"$PC\" asociado a arranque tipo \"$(head -1 $TMPLDIR/$TMPL |cut -f2 -d" ")\" (fichero $TMPL)" | 
|---|
| [7710a99] | 50 |         done | 
|---|
| [61dbabb] | 51 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.