diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-26 17:00:28 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-26 17:00:28 +0000 |
commit | 9ba81bbbe9b45ecb8af22c8563a50f9da61af966 (patch) | |
tree | f1358a1ed951283a92e7709d6e3d6ac1b9a19ddb | |
parent | 650f81d5b9b764b4ee897e0b04f936dadcfafa9f (diff) | |
download | drakx-9ba81bbbe9b45ecb8af22c8563a50f9da61af966.tar drakx-9ba81bbbe9b45ecb8af22c8563a50f9da61af966.tar.gz drakx-9ba81bbbe9b45ecb8af22c8563a50f9da61af966.tar.bz2 drakx-9ba81bbbe9b45ecb8af22c8563a50f9da61af966.tar.xz drakx-9ba81bbbe9b45ecb8af22c8563a50f9da61af966.zip |
get rid of global variables regarding connect/disconnect scripts
-rw-r--r-- | perl-install/network/netconnect.pm | 27 | ||||
-rw-r--r-- | perl-install/network/tools.pm | 6 | ||||
-rwxr-xr-x | perl-install/standalone/drakconnect | 18 | ||||
-rwxr-xr-x | perl-install/standalone/net_monitor | 11 |
4 files changed, 26 insertions, 36 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index a56b295df..a5956ba12 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -10,7 +10,7 @@ use any; use mouse; use network::network; use network::tools; -use MDK::Common::Globals "network", qw($in $connect_file $disconnect_file $connect_prog); +use MDK::Common::Globals "network", qw($in); my %conf; @@ -40,11 +40,7 @@ sub detect { sub init_globals { my ($in) = @_; - MDK::Common::Globals::init( - in => $in, - connect_file => "/etc/sysconfig/network-scripts/net_cnx_up", - disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down", - connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg"); + MDK::Common::Globals::init(in => $in); } sub detect_timezone() { @@ -1045,9 +1041,10 @@ Click on Ok to keep your configuration, or cancel to reconfigure your Internet & "), 1) and do { $netcnx->{type} = 'lan'; - output_with_perm("$::prefix$connect_file", 0755, qq(ifup eth0 + write_cnx_file( + "$::prefix$network::tools::connect_file", 0755, qq(ifup eth0 )); - output("$::prefix$disconnect_file", 0755, qq( + output("$::prefix$network::tools::disconnect_file", 0755, qq( ifdown eth0 )); $direct_net_install = 1; @@ -1081,7 +1078,7 @@ if [ -n "\$DISPLAY" ]; then /usr/sbin/net_monitor --connect fi else - $connect_file + $network::tools::connect_file fi ); } elsif ($netcnx->{type}) { @@ -1090,7 +1087,7 @@ fi if [ -n "\$DISPLAY" ]; then /usr/sbin/net_monitor --connect else - $connect_file + $network::tools::connect_file fi ); } else { @@ -1105,11 +1102,11 @@ fi if [ -n "\$DISPLAY" ]; then /usr/sbin/net_monitor --connect else - $connect_file + $network::tools::connect_file fi ); } - output_with_perm("$::prefix$connect_prog", 0755, $connect_cmd) if $connect_cmd; + output_with_perm("$::prefix$network::tools::connect_prog", 0755, $connect_cmd) if $connect_cmd; $netcnx->{$_} = $netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE); $netcnx->{type} =~ /adsl/ or system("/sbin/chkconfig --del adsl 2> /dev/null"); @@ -1158,7 +1155,7 @@ sub load_conf { } sub get_net_device() { - my $connect_file = "/etc/sysconfig/network-scripts/net_cnx_up"; + my $connect_file = $network::tools::connect_file; my $network_file = "/etc/sysconfig/network"; if (cat_("$::prefix$connect_file") =~ /ifup/) { if_(cat_($connect_file) =~ /^\s*ifup\s+(.*)/m, split(' ', $1)) @@ -1182,13 +1179,13 @@ sub start_internet { init_globals($o); #- give a chance for module to be loaded using kernel-BOOT modules... $::isStandalone or modules::load_category('network/main|gigabit|usb'); - run_program::rooted($::prefix, $connect_file); + run_program::rooted($::prefix, $network::tools::connect_file); } sub stop_internet { my ($o) = @_; init_globals($o); - run_program::rooted($::prefix, $disconnect_file); + run_program::rooted($::prefix, $network::tools::disconnect_file); } 1; diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 43dfff904..68eb03b86 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -5,13 +5,17 @@ use common; use run_program; use c; use vars qw(@ISA @EXPORT @EXPORT_OK); -use MDK::Common::Globals "network", qw($in $disconnect_file $connect_prog $connect_file); +use MDK::Common::Globals "network", qw($in); use MDK::Common::System qw(getVarsFromSh); @ISA = qw(Exporter); @EXPORT = qw(connect_backend connected connected_bg disconnect_backend is_dynamic_ip is_wireless_intf passwd_by_login read_providers_backend read_secret_backend test_connected write_cnx_script write_initscript write_secret_backend); @EXPORT_OK = qw($in); +our $connect_prog = "/etc/sysconfig/network-scripts/net_cnx_pg"; +my $connect_file = "/etc/sysconfig/network-scripts/net_cnx_up"; +my $disconnect_file = "/etc/sysconfig/network-scripts/net_cnx_down"; + sub write_cnx_script { my ($netc, $o_type, $o_up, $o_down, $o_type2) = @_; if ($o_type) { diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 165f3b5ad..55fa55064 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -38,7 +38,7 @@ use c; use modules; use network::isdn; use network::adsl; -use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_prog $connect_file); +use MDK::Common::Globals "network", qw($in); use POSIX ":sys_wait_h"; my ($netcnx, $netc, $intf) = ({}, {}, {}); @@ -53,13 +53,7 @@ reread_net_conf(); $::Wizard_title = N("Network & Internet Configuration"); $::Wizard_pix_up = "wiz_drakconnect.png"; -MDK::Common::Globals::init( - in => $in, - prefix => '', - connect_file => "/etc/sysconfig/network-scripts/net_cnx_up", - disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down", - connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg" - ); +MDK::Common::Globals::init(in => $in); local $_ = join '', @ARGV; /--skip-wizard/ and manage($netc, $netcnx, $intf); @@ -99,8 +93,8 @@ my $int_connect = Gtk2::Button->new(N("Wait please")); $int_connect->set_sensitive(0); $int_connect->signal_connect(clicked => sub { if (!$isconnected) { - if (cat_($connect_prog) =~ m|/usr/bin/kppp| && -e '/usr/bin/kppp') { - run_program::rooted($prefix, "/usr/bin/kppp &"); + if (cat_($network::tools::connect_prog) =~ m|/usr/bin/kppp| && -e '/usr/bin/kppp') { + run_program::run("/usr/bin/kppp &"); } else { connect_backend(); } @@ -603,9 +597,9 @@ sub apply { network::network::sethostname($netc) if is_dynamic_ip($intf); - network::network::configureNetwork2($in, $prefix, $netc, $intf); + network::network::configureNetwork2($in, '', $netc, $intf); $netcnx->{type} =~ /adsl/ or system("/sbin/chkconfig --del adsl 2> /dev/null"); - $netcnx->{type} !~ /adsl_p/ and system("$prefix/etc/rc.d/init.d/network restart"); + $netcnx->{type} !~ /adsl_p/ and system("/etc/rc.d/init.d/network restart"); $button_apply->set_sensitive(0); } diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor index 2530f891f..6594e61dc 100755 --- a/perl-install/standalone/net_monitor +++ b/perl-install/standalone/net_monitor @@ -30,7 +30,7 @@ use ugtk2 qw(:helpers :wrappers :create); use common; use network::netconnect; use network::tools; -use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog); +use MDK::Common::Globals "network", qw($in); if ("@ARGV" =~ /--status/) { print connected(); exit(0) } my $force = "@ARGV" =~ /--force/; @@ -75,12 +75,7 @@ my ($width, $height) = (300, 150); network::netconnect::load_conf($netcnx, $netc, $intf); network::netconnect::read_net_conf('', $netcnx, $netc); -MDK::Common::Globals::init( - in => $in, - prefix => '', - connect_file => "/etc/sysconfig/network-scripts/net_cnx_up", - disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down", - connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg"); +MDK::Common::Globals::init(in => $in); gtkadd($window1->{window}, gtkpack_(Gtk2::VBox->new(0,5), @@ -423,7 +418,7 @@ sub update() { $button_connect->set("label", $isconnected == 1 ? N("Disconnect %s", $netcnx->{type}) : N("Connect %s", $netcnx->{type})); $button_connect->set_sensitive(1); } - if (!(-e $connect_file && -e $disconnect_file)) { + if (!(-e $network::tools::connect_file && -e $network::tools::disconnect_file)) { $button_connect->set_sensitive(0); $button_connect->set("label", N("No internet connection configured")); } |