tazpanel view network.cgi @ rev 81

Use httpd_helper parser (GET)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Apr 13 16:41:02 2011 +0200 (2011-04-13)
parents 7ac8e561d0a5
children df959815c470
line source
1 #!/bin/sh
2 #
3 # Network configuration CGI interface
4 #
6 # Common functions from libtazpanel
7 . lib/libtazpanel
8 get_config
9 header
11 # Include gettext helper script.
12 . /usr/bin/gettext.sh
14 # Export package name for gettext.
15 TEXTDOMAIN='tazpanel'
16 export TEXTDOMAIN
18 TITLE="- Network"
20 # Actions commands before page is displayed
21 case " $(GET) " in
22 *\ start\ *)
23 # Here we sleep a bit to let udhcp get the lease before reloading
24 # page with status
25 /etc/init.d/network.sh start | log
26 sleep 2 ;;
27 *\ stop\ *)
28 /etc/init.d/network.sh stop | log ;;
29 *)
30 continue ;;
31 esac
33 #
34 # Main Commands for pages
35 #
37 case " $(GET) " in
38 *\ eth\ *)
39 # Wired connections settings
40 xhtml_header
42 cat << EOT
43 <h2>`gettext "Ethernet connection`</h2>
44 <pre>
45 `grep ^[A-V] /etc/network.conf`
46 </pre>
47 EOT
48 ;;
49 *\ wifi\ *)
50 # Wireless connections settings
51 xhtml_header
53 cat << EOT
54 <h2>`gettext "Wireless connection`</h2>
55 <pre>
56 `grep ^WIFI_ /etc/network.conf`
57 </pre>
58 EOT
59 ;;
60 *)
61 # Main Network page starting with a summary
62 xhtml_header
64 cat << EOT
65 <h2>`gettext "Networking`</h2>
66 <p>
67 `gettext "Manage network connections and services`
68 </p>
69 <div id="actions">
70 <div class="float-left">
71 `gettext "Connection:"`
72 <a class="button" href="$SCRIPT_NAME?start">`gettext "Start"`</a>
73 <a class="button" href="$SCRIPT_NAME?stop">`gettext "Stop"`</a>
74 </div>
75 <div class="float-right">
76 `gettext "Configuration file:"`
77 <a class="button" href="index.cgi?file=/etc/network.conf">network.conf</a>
78 </div>
79 </div>
81 `list_network_interfaces`
83 <h3>`gettext "Output of ifconfig"`</h3>
84 <pre>
85 `ifconfig`
86 </pre>
88 <h3>`gettext "Routing table"`</h3>
89 <pre>
90 `route -n`
91 </pre>
93 <h3>`gettext "Domain name resolution"`</h3>
94 <pre>
95 `cat /etc/resolv.conf`
96 </pre>
98 <h3>`gettext "ARP table"`</h3>
99 <pre>
100 `arp`
101 </pre>
102 EOT
103 ;;
104 esac
106 xhtml_footer
107 exit 0