summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-02-18 15:03:00 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-02-18 15:03:00 +0000
commit2f3aaac785391d3574f54a2eb7ebe5befab2c2d1 (patch)
treeaa3f657dba5a101375f7c8fd2f46ff2c01c9ec85 /perl-install/install_any.pm
parent5a222ad82ffcf5548f86c5efab8ffb90a8b7efb3 (diff)
downloaddrakx-2f3aaac785391d3574f54a2eb7ebe5befab2c2d1.tar
drakx-2f3aaac785391d3574f54a2eb7ebe5befab2c2d1.tar.gz
drakx-2f3aaac785391d3574f54a2eb7ebe5befab2c2d1.tar.bz2
drakx-2f3aaac785391d3574f54a2eb7ebe5befab2c2d1.tar.xz
drakx-2f3aaac785391d3574f54a2eb7ebe5befab2c2d1.zip
media_browser returns a filehandle when non save
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm27
1 files changed, 18 insertions, 9 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index d19e61472..2243dbdcc 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -1169,15 +1169,15 @@ sub getAndSaveAutoInstallFloppies {
sub g_default_packages {
my ($o) = @_;
- my ($_h, $file) = media_browser($o, 'save', 'package_list.pl') or return;
+ my ($_h, $fh) = media_browser($o, 'save', 'package_list.pl') or return;
require Data::Dumper;
my $str = Data::Dumper->Dump([ { default_packages => pkgs::selected_leaves($o->{packages}) } ], ['$o']);
$str =~ s/ {8}/\t/g;
- output($file,
- "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl'\n",
- "# before testing. To use it, boot with ``linux defcfg=floppy''\n",
- $str, "\0");
+ print $fh
+ "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl'\n" .
+ "# before testing. To use it, boot with ``linux defcfg=floppy''\n" .
+ $str . "\0";
}
sub loadO {
@@ -1202,10 +1202,14 @@ sub loadO {
};
$o = loadO($O, $f);
} else {
- -e "$f.pl" and $f .= ".pl" unless -e $f;
-
my $fh;
- if (-e $f) { open $fh, $f } else { $fh = getFile($f) or die N("Error reading file %s", $f) }
+ if (ref $f) {
+ $fh = $f;
+ } else {
+ -e "$f.pl" and $f .= ".pl" unless -e $f;
+
+ if (-e $f) { open $fh, $f } else { $fh = getFile($f) or die N("Error reading file %s", $f) }
+ }
{
local $/ = "\0";
no strict;
@@ -1552,7 +1556,12 @@ sub media_browser {
if (-e $file && $save) {
$in->ask_yesorno('', N("File already exists. Overwrite it?")) or next;
}
- return $h, $file if $save || -e $file;
+ if ($save) {
+ return $h, $file;
+ } else {
+ my $fh;
+ open($fh, $file) and return $h, $fh;
+ }
}
undef $h; #- help perl
} else {