source: client/shared/scripts/generateMenuDefault @ 9204a04

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 9204a04 was 8a45568, checked in by ramon <ramongomez@…>, 12 years ago

Versión 1.0.5, #501 #568: Evitar que el cliente para Linux se ejecute más de una vez; crear correctamente enlaces en menú por defecto.

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

  • Property mode set to 100755
File size: 2.1 KB
Line 
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
6
7DEVICE=${DEVICE:-"eth0"}
8source /tmp/net-$DEVICE.conf
9FILEINFOHTML=$OGLOG/`ogGetIpAddress`.info.html
10FILEINFOCACHE=$OGLOG/`ogGetIpAddress`.cache.txt
11ogMountCache 2>/dev/null
12CACHECONTENIDO=`ls -m $OGCAC/$OGIMG 2>/dev/null`
13
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
26CACHESIZEFREE=$(ogGetFreeSize `ogFindCache`)
27expr $CACHESIZEFREE / 1024 > $FILEINFOCACHE 2>/dev/null && echo '.MB,' >> $FILEINFOCACHE
28
29# Crear menú por defecto.
30cat > $FILEINFOHTML << EOT
31<div align="center" style="font-family: Arial, Helvetica, sans-serif;">
32<p style="color:#999999; font-size: 16px; margin: 2em;">
33
34<table border=1 width="100%">
35<tr>
36<td rowspan="2"><p align="left"><img border="0" src="../images/iconos/logoopengnsys.png"><p> </td>
37<td> $MSG_HOSTNAME </td> <td> $MSG_IPADDR </td> <td> $MSG_MACADDR </td> <td> $MSG_SPEED </td> <td> $MSG_DUPLEX </td> </tr>
38<tr> <td>$HOSTNAME </td> <td> $(ogGetIpAddress) </td> <td> $(ogGetMacAddress) </td> <td> $SPEED </td> <td> $DUPLEX </td> </tr>
39</table>
40</p>
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 2>/dev/null | cut -f2 -d:)
48        [ -n "$VERSION" ] && echo "<p><a href=\"command:bootOs $d $p\">$MSG_BOOT $VERSION ($d, $p)</a></p>" >>$FILEINFOHTML
49    done
50done
51
52cat >> $FILEINFOHTML << EOT
53<p><a href="command:poweroff">$MSG_POWEROFF</a></p>
54</div>
55EOT
56
57# Crear contenido de la caché.
58cat >> $FILEINFOCACHE << EOT
59$CACHECONTENIDO
60EOT
61
Note: See TracBrowser for help on using the repository browser.