summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-02 20:41:44 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-02 20:41:44 +0000
commit9519d51eb29b0a5881bc859e1c2b9b3b3a8abfa6 (patch)
tree61aeae2581a101186add4569667ddac27876bd0e /perl-install
parent5ea5e381f9840d127fe444d8eecf34be4c45d0e6 (diff)
downloaddrakx-9519d51eb29b0a5881bc859e1c2b9b3b3a8abfa6.tar
drakx-9519d51eb29b0a5881bc859e1c2b9b3b3a8abfa6.tar.gz
drakx-9519d51eb29b0a5881bc859e1c2b9b3b3a8abfa6.tar.bz2
drakx-9519d51eb29b0a5881bc859e1c2b9b3b3a8abfa6.tar.xz
drakx-9519d51eb29b0a5881bc859e1c2b9b3b3a8abfa6.zip
use output_with_perm()
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/any.pm27
-rw-r--r--perl-install/install_steps.pm3
-rw-r--r--perl-install/mouse.pm6
-rw-r--r--perl-install/network/isdn.pm5
-rw-r--r--perl-install/network/netconnect.pm28
-rw-r--r--perl-install/network/smb.pm3
-rw-r--r--perl-install/network/tools.pm7
7 files changed, 30 insertions, 49 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 511db03ba..6193f848d 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -455,9 +455,7 @@ sub pppConfig {
$toreplace{papname} = ($modem->{auth} eq 'PAP' || $modem->{auth} eq 'CHAP') && $toreplace{login};
#- build ifcfg-ppp0.
- my $ifcfg = "$prefix/etc/sysconfig/network-scripts/ifcfg-ppp0";
- local *IFCFG; open IFCFG, ">$ifcfg" or die "Can't open $ifcfg";
- print IFCFG <<END;
+ my $various = <<END;
DEVICE="$toreplace{intf}"
ONBOOT="no"
USERCTL="no"
@@ -482,15 +480,12 @@ RETRYTIMEOUT="60"
BOOTPROTO="none"
PEERDNS="$toreplace{peerdns}"
END
- foreach (1..2) {
- print IFCFG qq(DNS$_=$toreplace{"dns$_"}\n) if $toreplace{"dns$_"};
- }
- close IFCFG;
+ output("$prefix/etc/sysconfig/network-scripts/ifcfg-ppp0",
+ $various,
+ map { qq(DNS$_=$toreplace{"dns$_"}\n) } grep { $toreplace{"dns$_"} } 1..2);
#- build chat-ppp0.
- my $chat = "$prefix/etc/sysconfig/network-scripts/chat-ppp0";
- local *CHAT; open CHAT, ">$chat" or die "Can't open $chat";
- print CHAT <<END;
+ my @chat = <<END;
'ABORT' 'BUSY'
'ABORT' 'ERROR'
'ABORT' 'NO CARRIER'
@@ -500,26 +495,26 @@ END
'' 'ATZ'
END
if ($modem->{special_command}) {
- print CHAT <<END;
+ push @chat, <<END;
'OK' '$modem->{special_command}'
END
}
- print CHAT <<END;
+ push @chat, <<END;
'OK' 'ATDT$toreplace{phone}'
'CONNECT' ''
END
if ($modem->{auth} eq 'Terminal-based' || $modem->{auth} eq 'Script-based') {
- print CHAT <<END;
+ push @chat, <<END;
'ogin:--ogin:' '$toreplace{login}'
'ord:' '$toreplace{passwd}'
END
}
- print CHAT <<END;
+ push @chat, <<END;
'TIMEOUT' '5'
'~--' ''
END
- close CHAT;
- chmod 0600, $chat;
+ my $chat_file = "$prefix/etc/sysconfig/network-scripts/chat-ppp0";
+ output_with_perm($chat_file, 0600, @chat);
if ($modem->{auth} eq 'PAP' || $modem->{auth} eq 'CHAP') {
#- need to create a secrets file for the connection.
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 0892b39ab..a9a613f0a 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -634,8 +634,7 @@ sub configureNetwork {
$o->{netcnx}{type} = 'lan';
foreach ("up", "down") {
my $f = "$o->{prefix}/etc/sysconfig/network-scripts/net_cnx_$_";
- output $f, "\nif$_ eth0\n";
- chmod 0755, $f;
+ output_with_perm($f, 0755, "\nif$_ eth0\n");
}
output "$o->{prefix}/etc/sysconfig/network-scripts/net_cnx_pg", "\n/usr/sbin/drakconnet\n";
}
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
index 8ba23f7c4..cc164e38e 100644
--- a/perl-install/mouse.pm
+++ b/perl-install/mouse.pm
@@ -383,8 +383,7 @@ sub various_xfree_conf {
if ($mouse->{nbuttons} <= 5) {
unlink($f);
} else {
- output_p($f, "xmodmap -e 'pointer = 1 2 3 6 7 4 5'\n");
- chmod 0755, $f;
+ output_with_perm($f, 0755, "xmodmap -e 'pointer = 1 2 3 6 7 4 5'\n");
}
}
{
@@ -393,8 +392,7 @@ sub various_xfree_conf {
unlink($f);
} else {
$in->do_pkgs->install('xinput');
- output_p($f, "xinput set-button-map Mouse2 1 2 3 6 7 4 5\n");
- chmod 0755, $f;
+ output_with_perm($f, 0755, "xinput set-button-map Mouse2 1 2 3 6 7 4 5\n");
}
}
}
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index b485c2e1c..be13b4021 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -100,8 +100,7 @@ sub isdn_write_config_backend {
symlinkf("isdn" . $bundle . ".conf", "$prefix/etc/isdn/isdnctrl.conf");
symlinkf("ioptions" . $bundle, "$prefix/etc/ppp/ioptions");
} else {
- my $f = "$prefix/etc/isdn/profile/link/myisp";
- output($f,
+ output_with_perm("$prefix/etc/isdn/profile/link/myisp", 0600,
qq(
I4L_USERNAME="$isdn->{login}"
I4L_SYSNAME=""
@@ -110,8 +109,6 @@ I4L_REMOTE_OUT="$isdn->{phone_out}"
I4L_DIALMODE="$isdn->{dialing_mode}"
) . if_($isdn->{speed} =~ /128/, 'SLAVE="ippp1"
'));
- chmod 0600, $f;
-
output "$prefix/etc/isdn/profile/card/mycard",
qq(
I4L_MODULE="$isdn->{driver}"
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index f0ebedfc9..8f9b83136 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -138,16 +138,14 @@ sub main {
Click on Ok to keep your configuration, or cancel to reconfigure your Internet & Network connection.
"), 1)) and do {
$netcnx->{type} = 'lan';
- output "$prefix$connect_file",
+ output_with_perm("$prefix$connect_file", 0755,
qq(
ifup eth0
-);
- output "$prefix$disconnect_file",
+));
+ output("$prefix$disconnect_file", 0755,
qq(
ifdown eth0
-);
- chmod 0755, "$prefix$disconnect_file";
- chmod 0755, "$prefix$connect_file";
+));
$direct_net_install = 1;
goto step_5;
};
@@ -283,9 +281,9 @@ Test your connection via net_monitor or mcc. If your connection doesn't work, yo
$network_configured or network::configureNetwork2($in, $prefix, $netc, $intf);
+ my $connect_cmd;
if ($netcnx->{type} =~ /modem/ || $netcnx->{type} =~ /isdn_external/) {
- output "$prefix$connect_prog",
- qq(
+ $connect_cmd = qq(
#!/bin/bash
if [ -n "\$DISPLAY" ]; then
if [ -e /usr/bin/kppp ]; then
@@ -299,8 +297,7 @@ $connect_file
fi
);
} elsif ($netcnx->{type}) {
- output "$prefix$connect_prog",
- qq(
+ $connect_cmd = qq(
#!/bin/bash
if [ -n "\$DISPLAY" ]; then
/usr/sbin/net_monitor --connect
@@ -309,15 +306,13 @@ $connect_file
fi
);
} else {
- output "$prefix$connect_prog",
- qq(
+ $connect_cmd = qq(
#!/bin/bash
/usr/sbin/drakconnect
);
}
if ($direct_net_install) {
- output "$prefix$connect_prog",
- qq(
+ $connect_cmd = qq(
#!/bin/bash
if [ -n "\$DISPLAY" ]; then
/usr/sbin/net_monitor --connect
@@ -326,7 +321,7 @@ $connect_file
fi
);
}
- chmod 0755, "$prefix$connect_prog";
+ output_with_perm("$prefix$connect_prog", 0755, $connect_cmd) if $connect_cmd;
$netcnx->{$_} = $netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE);
$netcnx->{NET_INTERFACE} and set_net_conf($netcnx, $netc);
@@ -354,7 +349,7 @@ sub save_conf {
$intf = { %$intf };
- output("$prefix/etc/sysconfig/network-scripts/drakconnect_conf",
+ output_with_perm("$prefix/etc/sysconfig/network-scripts/drakconnect_conf", 0600,
"SystemName=" . do { $netc->{HOSTNAME} =~ /([^\.]*)\./; $1 } . "
DomainName=" . do { $netc->{HOSTNAME} =~ /\.(.*)/; $1 } . "
InternetAccessType=" . do { if ($netcnx->{type}) { $netcnx->{type} } else { $netc->{GATEWAY} ? "lan" : "" } } . "
@@ -430,7 +425,6 @@ ADSLLogin=$adsl->{login}
ADSLPassword=$adsl->{passwd}
DOMAINNAME2=$netc->{DOMAINNAME2}"
);
- chmod 0600, "$prefix/etc/sysconfig/network-scripts/drakconnect_conf";
my $a = $netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default";
cp_af("$prefix/etc/sysconfig/network-scripts/drakconnect_conf", "$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . $a);
chmod 0600, "$prefix/etc/sysconfig/network-scripts/drakconnect_conf";
diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm
index 06bd70609..e3dfc9ce6 100644
--- a/perl-install/network/smb.pm
+++ b/perl-install/network/smb.pm
@@ -131,8 +131,7 @@ sub remove_bad_credentials {
sub save_credentials {
my ($credentials) = @_;
my $file = $credentials->{file};
- output_p("$::prefix$file", map { "$_ = $credentials->{$_}\n" } qw(username domain password));
- chmod(0640, "$::prefix$file");
+ output_with_perm("$::prefix$file", 0640, map { "$_ = $credentials->{$_}\n" } qw(username domain password));
}
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 55c8b8a89..48809e8ef 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -18,11 +18,10 @@ sub write_cnx_script {
$netc->{internet_cnx}{$type}{type} = $type2;
} else {
foreach ($connect_file, $disconnect_file) {
- output("$prefix$_",
+ 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}}{$_});
- chmod 0755, "$prefix$_";
}
}
}
@@ -223,7 +222,8 @@ sub disconnected {}
sub write_initscript {
- output("$prefix/etc/rc.d/init.d/internet", sprintf(<<'EOF', $connect_file, $connect_file, $disconnect_file, $disconnect_file));
+ output_with_perm("$prefix/etc/rc.d/init.d/internet", 0755,
+ sprintf(<<'EOF', $connect_file, $connect_file, $disconnect_file, $disconnect_file));
#!/bin/bash
#
# internet Bring up/down internet connection
@@ -267,7 +267,6 @@ sub write_initscript {
esac
exit 0
EOF
- chmod 0755, "$prefix/etc/rc.d/init.d/internet";
$::isStandalone ? system("/sbin/chkconfig --add internet") : do {
symlinkf("../init.d/internet", "$prefix/etc/rc.d/rc$_") foreach
'0.d/K11internet', '1.d/K11internet', '2.d/K11internet', '3.d/S89internet', '5.d/S89internet', '6.d/K11internet';