diff options
author | Olivier Blin <oblin@mandriva.org> | 2004-08-17 15:40:16 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2004-08-17 15:40:16 +0000 |
commit | 4e04412c49cbf2d4fb541d7e9793eb1449f97de0 (patch) | |
tree | ab5803b4a28faf394707aabf18f280c8655808ce /perl-install/standalone | |
parent | cf272c68aac616b5f12a2efe12584db21ba88214 (diff) | |
download | drakx-4e04412c49cbf2d4fb541d7e9793eb1449f97de0.tar drakx-4e04412c49cbf2d4fb541d7e9793eb1449f97de0.tar.gz drakx-4e04412c49cbf2d4fb541d7e9793eb1449f97de0.tar.bz2 drakx-4e04412c49cbf2d4fb541d7e9793eb1449f97de0.tar.xz drakx-4e04412c49cbf2d4fb541d7e9793eb1449f97de0.zip |
use network::tools::get_internet_connection
Diffstat (limited to 'perl-install/standalone')
-rw-r--r-- | perl-install/standalone/net_applet | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index f07183694..58ef1e7d7 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -1,10 +1,12 @@ #!/usr/bin/perl use strict; -use lib qw(/usr/lib/libDrakX); +use lib qw(/home/blino/cvs/gi/perl-install /usr/lib/libDrakX); use c; use common; use Digest::MD5; +use network::netconnect; +use network::tools; use Gtk2::TrayIcon; @@ -34,7 +36,7 @@ my %appletstate = ( menu => [ 'confNetwork', 'refresh', 'help' ], tt => [ #-PO: keep the "Configure Network" substring synced with the "Configure Network" message below - N_("Network is down. Click on \"Configure Network\"") + N_("Network is down on interface %d. Click on \"Configure Network\"") ] } ); @@ -92,21 +94,16 @@ sub netMonitor() { checkNetwork() } sub checkNetwork() { - my $gatewayconf = '/etc/sysconfig/network'; - my %h = getVarsFromSh($gatewayconf); - my $new_md5 = md5file($prog_name); - # print "NEW($newmd5) = OLD($oldmd5)\n" - my ($gd, $addrgd); - if ($h{GATEWAYDEV}) { - $addrgd = getIP($gd = $h{GATEWAYDEV}); - } else { - ($addrgd, $gd) = `/sbin/ip route show` =~ /^default\s+via\s+(\S+).*\s+dev\s+(\S+)/m; - } - - if ($addrgd) { - go2State('connected', $gd) - } else { go2State('disconnected', '') } + my $netcnx = {}; + my $netc = {}; + my $intf = {}; + network::netconnect::read_net_conf($netcnx, $netc, $intf); + my ($gw_intf, $is_up, $gw_address, $dns_server) = network::tools::get_internet_connection($netc, $intf); + if ($gw_address) { + go2State('connected', $gw_intf) + } else { go2State('disconnected', $gw_intf) } + my $new_md5 = md5file($prog_name); if ($new_md5 ne $current_md5) { exec($prog_name) }; } sub getIP { |