summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/diskdrake/interactive.pm6
-rw-r--r--perl-install/install_any.pm27
-rw-r--r--perl-install/install_steps_interactive.pm4
-rw-r--r--perl-install/partition_table.pm7
4 files changed, 29 insertions, 15 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index a0cdb98a1..ad252332f 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -371,17 +371,17 @@ sub More {
sub ReadFromFile {
my ($in, $hd) = @_;
- my ($h, $file) = ('', '');
+ my ($h, $file, $fh);
if ($::isStandalone) {
$file = $in->ask_file(N("Select file")) or return;
} else {
undef $h; #- help perl_checker
my $name = $hd->{device}; $name =~ s!/!_!g;
- ($h, $file) = install_any::media_browser($in, '', "part_$name") or return;
+ ($h, $fh) = install_any::media_browser($in, '', "part_$name") or return;
}
eval {
- catch_cdie { partition_table::load($hd, $file) }
+ catch_cdie { partition_table::load($hd, $file || $fh) }
sub {
$@ =~ /bad totalsectors/ or return;
$in->ask_yesorno('',
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 {
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 92b7fd7e5..13cc0a5f2 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -499,8 +499,8 @@ The format is the same as auto_install generated files."),
if ($choice eq 'Load') {
while (1) {
log::l("load package selection");
- my ($_h, $file) = install_any::media_browser($o, '', 'package_list.pl') or return;
- my $O = eval { install_any::loadO(undef, $file) };
+ my ($_h, $fh) = install_any::media_browser($o, '', 'package_list.pl') or return;
+ my $O = eval { install_any::loadO(undef, $fh) };
if ($@) {
$o->ask_okcancel('', N("Bad file")) or return;
} else {
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index c4efd7d27..f6fe086c0 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -596,7 +596,12 @@ sub next_start {
sub load {
my ($hd, $file, $b_force) = @_;
- open(my $F, $file) or die N("Error reading file %s", $file);
+ my $F;
+ if (ref $file) {
+ $F = $file;
+ } else {
+ open($F, $file) or die N("Error reading file %s", $file);
+ }
my $h;
{