From cc811738967e8413a73da19380af65215822b1e2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 29 Jan 2004 22:43:14 +0000 Subject: (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 --- perl-install/network/tools.pm | 22 +++++++++++----------- 1 file 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}}{$_}); - } } } -- cgit v1.2.1