slitaz-tools rev 375
netbox: add openvpn & ethtool status
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Aug 13 14:13:04 2009 +0200 (2009-08-13) |
parents | f42ec52d7e54 |
children | afcfdf317aa1 |
files | tinyutils/netbox |
line diff
1.1 --- a/tinyutils/netbox Wed Aug 12 14:24:49 2009 +0200 1.2 +++ b/tinyutils/netbox Thu Aug 13 14:13:04 2009 +0200 1.3 @@ -80,7 +80,7 @@ 1.4 cat << EOT 1.5 <button> 1.6 <input file icon="help"></input>$label 1.7 - <action>$xterm -geometry $2 -title "$1 help (q to quit)" -e "$(which $1) --help 2>&1 | less"</action> 1.8 + <action>$xterm -geometry $2 -title "$1 help (q to quit)" -e "( echo ; $(which $1) --help 2>&1 ) | less"</action> 1.9 </button> 1.10 EOT 1.11 } 1.12 @@ -373,6 +373,14 @@ 1.13 # 1.14 tab_status_iface() 1.15 { 1.16 +local eth 1.17 +eth="$( (cd /sys/class/net ; [ -d eth0 ] && ls -d eth* ) )" 1.18 +which ethtool > /dev/null || eth='' 1.19 +if [ -n "$eth" ]; then 1.20 + cat <<EOT 1.21 +<notebook labels="Ifconfig|$(echo $eth | sed 's/ /|/g')"> 1.22 +EOT 1.23 +fi 1.24 cat <<EOT 1.25 <frame Ifconfig> 1.26 <text wrap="false" width-chars="58"> 1.27 @@ -380,6 +388,21 @@ 1.28 </text> 1.29 </frame> 1.30 EOT 1.31 +if [ -n "$eth" ]; then 1.32 + local i 1.33 + for i in $eth ; do 1.34 + cat <<EOT 1.35 +<frame $i> 1.36 + <text wrap="false" width-chars="58"> 1.37 + <input>ethtool $i</input> 1.38 + </text> 1.39 +</frame> 1.40 +EOT 1.41 + done 1.42 + cat <<EOT 1.43 +</notebook> 1.44 +EOT 1.45 +fi 1.46 } 1.47 1.48 # 1.49 @@ -1032,6 +1055,31 @@ 1.50 EOT 1.51 } 1.52 1.53 +# 1.54 +# OpenVPN 1.55 +# 1.56 +tab_openvpn() 1.57 +{ 1.58 +local i 1.59 +local n 1.60 +cat <<EOT 1.61 +<frame OpenVPN> 1.62 +EOT 1.63 +n=1 1.64 +for i in /etc/openvpn/*.conf ; do 1.65 + [ -f $i ] || continue 1.66 + configfile $i OPENVPN_CONF$n 1.67 + n=$(($n + 1)) 1.68 +done 1.69 +cat <<EOT 1.70 + <hbox> 1.71 + $(helpbutton openvpn 80x40) 1.72 + $(startstopdaemon openvpn) 1.73 + </hbox> 1.74 +</frame> 1.75 +EOT 1.76 +} 1.77 + 1.78 data_vpn() 1.79 { 1.80 cat <<EOT 1.81 @@ -1039,7 +1087,7 @@ 1.82 echo "#") PPP/SSH tab_sshppp 1.83 pptp PPTP tab_pptp 1.84 vpnc EasyVPN tab_easyvpn 1.85 -#TODO openvpn OpenVPN tab_openvpn 1.86 +openvpn OpenVPN tab_openvpn 1.87 EOT 1.88 } 1.89 1.90 @@ -1401,7 +1449,7 @@ 1.91 data_http() 1.92 { 1.93 cat <<EOT 1.94 -httpd Dnsd tab_apache 1.95 +httpd Apache tab_apache 1.96 lighttpd Named tab_lighttpd 1.97 EOT 1.98 #TODO busybox httpd 1.99 @@ -1606,6 +1654,44 @@ 1.100 <action>ether-wake \$ETHERWAKE_OPTS</action> 1.101 </button> 1.102 </hbox> 1.103 + <frame> 1.104 + <hbox> 1.105 +EOT 1.106 +if which ethtool > /dev/null; then 1.107 +cat <<EOT 1.108 + <text use-markup="true"> 1.109 + <label>"<b>Interface:</b>"</label> 1.110 + </text> 1.111 + <combobox> 1.112 + <variable>ETHERWAKE_ETH</variable> 1.113 +EOT 1.114 +(cd /sys/class/net ; [ -d eth0 ] && ls -d eth* ) | \ 1.115 +awk '{ printf " <item>%s</item>\n",$1 }' 1.116 +cat <<EOT 1.117 + </combobox> 1.118 + <button> 1.119 + <label>Enable Wake On LAN</label> 1.120 + <input file icon="forward"></input> 1.121 + <action>ethtool -s \$ETHERWAKE_ETH wok g</action> 1.122 + </button> 1.123 +EOT 1.124 +else 1.125 +cat <<EOT 1.126 + <vbox> 1.127 + <text wrap="true" width-chars="58"> 1.128 + <label> 1.129 +"Ethtool utility can enable Wake-on-lan 1.130 +feature on many Ethernet card. 1.131 +" 1.132 + </label> 1.133 + </text> 1.134 +$(installbox ethtool) 1.135 + </vbox> 1.136 +EOT 1.137 +fi 1.138 +cat <<EOT 1.139 + </hbox> 1.140 + </frame> 1.141 </frame> 1.142 EOT 1.143 } 1.144 @@ -1768,9 +1854,6 @@ 1.145 # client server secret IP addresses 1.146 _EOT_ 1.147 fi 1.148 -cat > toto <<EOT 1.149 -$NET_BOX 1.150 -EOT 1.151 gtkdialog --center --program=NET_BOX | grep -a 'EXIT="restart"' && continue 1.152 exit 0 1.153 done