diff options
author | Olivier Blin <oblin@mandriva.org> | 2004-07-12 07:01:10 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2004-07-12 07:01:10 +0000 |
commit | e287c2b4d3cb08841b121aee7ce362dc5afbb86d (patch) | |
tree | 68ca8a077891cae54ed722474e3c80f31d46f31a /perl-install/standalone | |
parent | 66cadcb4268e31fd8352dc2a9f80f55e9b92a536 (diff) | |
download | drakx-e287c2b4d3cb08841b121aee7ce362dc5afbb86d.tar drakx-e287c2b4d3cb08841b121aee7ce362dc5afbb86d.tar.gz drakx-e287c2b4d3cb08841b121aee7ce362dc5afbb86d.tar.bz2 drakx-e287c2b4d3cb08841b121aee7ce362dc5afbb86d.tar.xz drakx-e287c2b4d3cb08841b121aee7ce362dc5afbb86d.zip |
use 'ip route show' to find the gateway device when no GATEWAYDEV is defined
Diffstat (limited to 'perl-install/standalone')
-rw-r--r-- | perl-install/standalone/net_applet | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index 265664c17..59fb3d781 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -99,12 +99,21 @@ sub checkNetwork { my %h = getVarsFromSh($gatewayconf); my $new_md5 = md5file($prog_name); # print "NEW($newmd5) = OLD($oldmd5)\n" + my $gd, $addrgd; if ($h{GATEWAYDEV}) { - my $addrgd = getIP($h{GATEWAYDEV}); - if ($addrgd) { - go2State('connected', $h{GATEWAYDEV}) - } else { go2State('disconnected', '') } - } else { die "No Gatewaydev defined" } + $addrgd = getIP($gd = $h{GATEWAYDEV}); + } else { + foreach (`/sbin/ip route show`) { + ($addrgd, $gd) = /^default\s+via\s+(\S+).*\s+dev\s+(\S+)/ and last; + } + } + + $gd or die "No Gatewaydev defined"; + + if ($addrgd) { + go2State('connected', $gd) + } else { go2State('disconnected', '') } + if ($new_md5 ne $current_md5) { exec($prog_name) }; } sub getIP { |