From dc6d19b1cc33b5bf7ad00589183fab12ce192cdd Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 30 Aug 2004 11:16:31 +0000 Subject: move start_interface and stop_interface from net_monitor to network::tools, use it in net_monitor and net_applet --- perl-install/network/tools.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'perl-install/network') diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 536870973..cfd92734b 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -9,7 +9,7 @@ use vars qw(@ISA @EXPORT @EXPORT_OK); use MDK::Common::System qw(getVarsFromSh); @ISA = qw(Exporter); -@EXPORT = qw(connect_backend connected connected_bg disconnect_backend is_dynamic_ip passwd_by_login read_secret_backend set_cnx_script test_connected write_cnx_script remove_initscript write_secret_backend); +@EXPORT = qw(connect_backend connected connected_bg disconnect_backend is_dynamic_ip passwd_by_login read_secret_backend set_cnx_script test_connected write_cnx_script remove_initscript write_secret_backend start_interface stop_interface); our $connect_prog = "/etc/sysconfig/network-scripts/net_cnx_pg"; our $connect_file = "/etc/sysconfig/network-scripts/net_cnx_up"; @@ -82,6 +82,21 @@ sub disconnect_backend { run_program::rooted($::prefix, "ifdown $netc->{NET_INTERFACE} &"); } +sub bg_command_as_root { + my ($name, @args) = @_; + run_program::raw({ detach => 1 }, [ 'consolehelper', $name ], @args); +} + +sub start_interface { + my ($intf) = @_; + bg_command_as_root('/sbin/ifup', $intf); +} + +sub stop_interface { + my ($intf) = @_; + bg_command_as_root('/sbin/ifdown', $intf); +} + sub connected() { gethostbyname("mandrakesoft.com") ? 1 : 0 } # request a ref on a bg_connect and a ref on a scalar -- cgit v1.2.1