diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-29 22:43:14 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-29 22:43:14 +0000 |
commit | cc811738967e8413a73da19380af65215822b1e2 (patch) | |
tree | aa25e1ef22da4ef27de7cb51128e10df9f1cf2aa | |
parent | e9f647aceeb9c8573babd6cc5014cbe6d5c8f2f6 (diff) | |
download | drakx-cc811738967e8413a73da19380af65215822b1e2.tar drakx-cc811738967e8413a73da19380af65215822b1e2.tar.gz drakx-cc811738967e8413a73da19380af65215822b1e2.tar.bz2 drakx-cc811738967e8413a73da19380af65215822b1e2.tar.xz drakx-cc811738967e8413a73da19380af65215822b1e2.zip |
(set_cnx_script) split it out of write_cnx_script()
rationale:functions whose behavior is totally altered by arguments
number are insane should just be splited and their callers be fixed
-rw-r--r-- | perl-install/network/tools.pm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 68eb03b86..661cf79bc 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -9,25 +9,25 @@ 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 = qw(connect_backend connected connected_bg disconnect_backend is_dynamic_ip is_wireless_intf passwd_by_login read_providers_backend read_secret_backend set_cnx_script test_connected write_cnx_script write_initscript write_secret_backend); @EXPORT_OK = qw($in); -our $connect_prog = "/etc/sysconfig/network-scripts/net_cnx_pg"; +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 set_cnx_script { + my ($netc, $type, $up, $down, $type2) = @_; + $netc->{internet_cnx}{$type}{$_->[0]} = $_->[1] foreach [$connect_file, $up], [$disconnect_file, $down]; + $netc->{internet_cnx}{$type}{type} = $type2; +} sub write_cnx_script { - my ($netc, $o_type, $o_up, $o_down, $o_type2) = @_; - if ($o_type) { - $netc->{internet_cnx}{$o_type}{$_->[0]} = $_->[1] foreach [$connect_file, $o_up], [$disconnect_file, $o_down]; - $netc->{internet_cnx}{$o_type}{type} = $o_type2; - } else { - foreach ($connect_file, $disconnect_file) { - output_with_perm("$::prefix$_", 0755, -'#!/bin/bash + my ($netc) = @_; + foreach ($connect_file, $disconnect_file) { + output_with_perm("$::prefix$_", 0755, + '#!/bin/bash ' . if_(!$netc->{at_boot}, 'if [ "x$1" == "x--boot_time" ]; then exit; fi ') . $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{$_}); - } } } |