diff options
author | damien <damien@mandriva.com> | 2001-08-14 17:28:24 +0000 |
---|---|---|
committer | damien <damien@mandriva.com> | 2001-08-14 17:28:24 +0000 |
commit | 37dc8031ea27a00e421ef1f4381a4a3233329c18 (patch) | |
tree | c801f693674b83c4309e15e40f636864f20003ff /perl-install | |
parent | 88a451a1b4f76a056985d12ef096f6d3592cf023 (diff) | |
download | drakx-backup-do-not-use-37dc8031ea27a00e421ef1f4381a4a3233329c18.tar drakx-backup-do-not-use-37dc8031ea27a00e421ef1f4381a4a3233329c18.tar.gz drakx-backup-do-not-use-37dc8031ea27a00e421ef1f4381a4a3233329c18.tar.bz2 drakx-backup-do-not-use-37dc8031ea27a00e421ef1f4381a4a3233329c18.tar.xz drakx-backup-do-not-use-37dc8031ea27a00e421ef1f4381a4a3233329c18.zip |
added options
Diffstat (limited to 'perl-install')
-rwxr-xr-x | perl-install/standalone/net_monitor | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor index e3283bf52..44dcc5074 100755 --- a/perl-install/standalone/net_monitor +++ b/perl-install/standalone/net_monitor @@ -30,12 +30,34 @@ use network::netconnect; use network::tools; use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog); -my ($connect, $default_intf); +"@ARGV" =~ /--help/ and print q(Network & Internet connection and monitoring application + +--defaultintf interface : show this interface by default +--connect : connect to internet if not already connected +--disconnect : disconnect to internet if already connected +--force : used with (dis)connect : force (dis)connection. +--status : returns 1 if connected 0 otherwise, then exit. +--quiet : don't be interactive. To be used with (dis)connect. +); + +if ("@ARGV" =~ /--status/) { print connected(); exit(0) } +my $force = "@ARGV" =~ /--force/; +my $quiet = "@ARGV" =~ /--quiet/; +my $connect = "@ARGV" =~ /--connect/; +my $disconnect = "@ARGV" =~ /--disconnect/; +my ($default_intf) = "@ARGV" =~ /--defaultintf (\w+)/; + +if ($force) { + $connect and system("/etc/sysconfig/network-scripts/net_cnx_up &"); + $disconnect and system("/etc/sysconfig/network-scripts/net_cnx_down &"); + $connect = $disconnect = 0; +} +$quiet and exit(0); init Gtk; my $in = 'interactive'->vnew('su', 'default'); $::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/; -($default_intf) = "@ARGV" =~ /--defaultintf (\w+)/; -$connect = "@ARGV" =~ /--connect/; + + my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; $window1->signal_connect ( delete_event => sub { Gtk->exit(0); }); $window1->set_position(1); @@ -130,9 +152,9 @@ $window1->show_all(); my $time_tag = Gtk->timeout_add(1000, \&rescan); my $time_tag2 = Gtk->timeout_add(5000, \&update); update(); - rescan(); -connection() if ($connect && ! $isconnected); +connection() if ($connect && !$isconnected); +connection() if ($disconnect && $isconnected); Gtk->main; Gtk->exit(0); |