source: client/shared/scripts/generateMenuDefault @ df1ffe5

918-git-images-111dconfigfileconfigure-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-instalacionwebconsole3
Last change on this file since df1ffe5 was 1e8c4f7, checked in by ramon <ramongomez@…>, 12 years ago

Versión 1.0.5, #568: Modificado script para crear el menú por defecto, incluyendo opciones de inicio de sistemas operativos y apagado del equipo.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3441 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 2.1 KB
RevLine 
[1e8c4f7]1#!/bin/bash
2# generateMenuDefault - Crea fichero con la página web de inicio del cliente
3#                       con información de red y de los sistemas operativos instalados,
4#                       crea fichero con información del contenido de la caché local.
5
[3ba65df]6
[1663c67]7DEVICE=${DEVICE:-"eth0"}
8source /tmp/net-$DEVICE.conf
[31c148d8]9FILEINFOHTML=$OGLOG/`ogGetIpAddress`.info.html
10FILEINFOCACHE=$OGLOG/`ogGetIpAddress`.cache.txt
11ogMountCache 2>/dev/null
12CACHECONTENIDO=`ls -m $OGCAC/$OGIMG 2>/dev/null`
[3ba65df]13
[31c148d8]14SPEED=$(LANG=C ethtool $DEVICE 2>/dev/null | awk '$1~/Speed/ {print $2}')
15case "$SPEED" in
16        1000[Mm]b/s)    ;;
17        100[Mm]b/s)     SPEED="<font color=\"blue\">$SPEED</font>" ;;
18        10[Mm]b/s)      SPEED="<font color=\"grey\">$SPEED</font>" ;;
19        *)              SPEED="<font color=\"red\">$SPEED</font>" ;;
20esac
21DUPLEX=$(LANG=C ethtool $DEVICE 2>/dev/null | awk '$1~/Duplex/ {print $2}')
22case "$DUPLEX" in
23        [Ff]ull)        ;;
24        *)              DUPLEX="<font color=\"red\">$DUPLEX</font>"
25esac
[1873b9a]26CACHESIZEFREE=$(ogGetFreeSize `ogFindCache`)
[31c148d8]27expr $CACHESIZEFREE / 1024 > $FILEINFOCACHE 2>/dev/null && echo '.MB,' >> $FILEINFOCACHE
[3ba65df]28
[1e8c4f7]29# Crear menú por defecto.
30cat > $FILEINFOHTML << EOT
[1873b9a]31<div align="center" style="font-family: Arial, Helvetica, sans-serif;">
[3ba65df]32<p style="color:#999999; font-size: 16px; margin: 2em;">
33
[1873b9a]34<table border=1 width="100%">
35<tr>
[31c148d8]36<td rowspan="2"><p align="left"><img border="0" src="../images/iconos/logoopengnsys.png"><p> </td>
[1e8c4f7]37<td> $MSG_HOSTNAME </td> <td> $MSG_IPADDR </td> <td> $MSG_MACADDR </td> <td> $MSG_SPEED </td> <td> $MSG_DUPLEX </td> </tr>
[31c148d8]38<tr> <td>$HOSTNAME </td> <td> $(ogGetIpAddress) </td> <td> $(ogGetMacAddress) </td> <td> $SPEED </td> <td> $DUPLEX </td> </tr>
[3ba65df]39</table>
40</p>
[1e8c4f7]41
42<h1>$MSG_MENUTITLE</h1>
43EOT
44
45for ((d=1; d<=$(ogDiskToDev | wc -w); d++)); do
46    for ((p=1; p<=$(ogGetPartitionsNumber $d); p++)); do
47        VERSION=$(ogGetOsVersion $d $p | cut -f2 -d:)
48        [ -n "$VERSION" ] && echo "<p><a href=\"command:bootOs $d $p\">$MSG_BOOT $VERSION ($d, $p)</p>" >>$FILEINFOHTML
49    done
50done
51
52cat >> $FILEINFOHTML << EOT
53<p><a href="command:poweroff">$MSG_POWEROFF</p>
[3ba65df]54</div>
[1e8c4f7]55EOT
[3ba65df]56
[1e8c4f7]57# Crear contenido de la caché.
58cat >> $FILEINFOCACHE << EOT
[1873b9a]59$CACHECONTENIDO
[1e8c4f7]60EOT
[31c148d8]61
Note: See TracBrowser for help on using the repository browser.