summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/common.pm1
-rw-r--r--perl-install/detect_devices.pm8
-rw-r--r--perl-install/fs.pm24
-rw-r--r--perl-install/install_steps.pm2
4 files changed, 27 insertions, 8 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 2c9121e6e..c9366977f 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -63,6 +63,7 @@ sub bool2text { $_[0] ? "true" : "false" }
sub text2bool { my $t = lc($_[0]); $t eq "true" || $t eq "yes" ? 1 : 0 }
sub strcpy { substr($_[0], $_[2] || 0, length $_[1]) = $_[1] }
sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l }
+sub linkf { unlink $_[1]; link $_[0], $_[1] }
sub symlinkf { unlink $_[1]; symlink $_[0], $_[1] }
sub chop_ { map { my $l = $_; chomp $l; $l } @_ }
sub divide { my $d = int $_[0] / $_[1]; wantarray ? ($d, $_[0] % $_[1]) : $d }
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 35a85dfc5..994fd30fb 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -35,13 +35,19 @@ sub get {
[ \&hasDAC960, \&getDAC960 ],
[ \&hasCompaqSmartArray, \&getCompaqSmartArray ];
}
-sub hds() { grep { $_->{type} eq 'hd' } get(); }
+sub hds() { grep { $_->{type} eq 'hd' && !isRemovableDrive($_) } get(); }
+sub zips() { grep { $_->{type} eq 'hd' && isZipDrive($_) } get(); }
+#-sub jazzs() { grep { $_->{type} eq 'hd' && isJazDrive($_) } get(); }
sub cdroms() { grep { $_->{type} eq 'cdrom' } get(); }
sub floppies() {
(grep { tryOpen($_) } qw(fd0 fd1)),
(grep { $_->{type} eq 'fd' } get());
}
+sub isZipDrive() { $_[0]->{info} =~ /ZIP\s+\d+/ } #- accept ZIP 100, untested for bigger ZIP drive.
+#-sub isJazzDrive() { $_[0]->{info} =~ /JAZZ?\s+/ } #- untested.
+sub isRemovableDrive() { &isZipDrive } #-or &isJazzDrive }
+
sub hasSCSI() {
defined $scsiDeviceAvailable and return $scsiDeviceAvailable;
local *F;
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index eac303647..36a480ee3 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -201,7 +201,13 @@ sub write($$) {
mkdir "$prefix/mnt/cdrom$i", 0755 or log::l("failed to mkdir $prefix/mnt/cdrom$i: $!");
symlinkf $_->{device}, "$prefix/dev/cdrom$i" or log::l("failed to symlink $prefix/dev/cdrom$i: $!");
[ "/dev/cdrom$i", "/mnt/cdrom$i", "auto", "user,noauto,nosuid,exec,nodev,ro", 0, 0 ];
- } detect_devices::cdroms());
+ } detect_devices::cdroms(),
+ map_index { #- for zip drives, the right partition is the 4th.
+ my $i = $::i ? $::i + 1 : '';
+ mkdir "$prefix/mnt/zip$i", 0755 or log::l("failed to mkdir $prefix/mnt/zip$i: $!");
+ symlinkf "$_->{device}4", "$prefix/dev/zip$i" or log::l("failed to symlink $prefix/dev/zip$i: $!");
+ [ "/dev/zip$i", "/mnt/zip$i", "auto", "user,noauto,nosuid,exec,nodev", 0, 0 ];
+ } detect_devices::zips());
write_fstab($fstab, $prefix, @to_add);
}
@@ -209,6 +215,12 @@ sub write_fstab($;$$) {
my ($fstab, $prefix, @to_add) = @_;
$prefix ||= '';
+ #- get the list of devices and mntpoint to remove existing entries
+ #- and @to_add take precedence over $fstab to handle removable device
+ #- if they are mounted OR NOT during install.
+ my @new = grep { $_ ne 'none' } map { @$_[0,1] } @to_add;
+ my %new; @new{@new} = undef;
+
unshift @to_add,
map {
my ($dir, $options, $freq, $passno) = qw(/dev/ defaults 0 0);
@@ -217,15 +229,15 @@ sub write_fstab($;$$) {
isExt2($_) and ($freq, $passno) = (1, ($_->{mntpoint} eq '/') ? 1 : 2);
isNfs($_) and ($dir, $options) = ('', 'ro');
+ #- keep in mind the new line for fstab.
+ @new{($_->{mntpoint}, $_->{"$dir$_->{device}"})} = undef;
+
devices::make("$prefix/$dir$_->{device}") if $_->{device} && $dir;
[ "$dir$_->{device}", $_->{mntpoint}, type2fs($_->{type}), $options, $freq, $passno ];
- } grep { $_->{mntpoint} && type2fs($_->{type}) } @$fstab;
-
- #- get the list of devices and mntpoint
- my @new = grep { $_ ne 'none' } map { @$_[0,1] } @to_add;
- my %new; @new{@new} = undef;
+ } grep { $_->{mntpoint} && type2fs($_->{type}) &&
+ ! exists $new{$_->{mntpoint}} && ! exists $new{"/dev/$_->{device}"} } @$fstab;
my @current = cat_("$prefix/etc/fstab");
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 9c916cc5b..ee62d62bf 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -59,7 +59,7 @@ sub leavingStep($$) {
my ($o, $step) = @_;
log::l("step `$step' finished");
- eval { commands::cp('-f', "/tmp/ddebug.log", "$o->{prefix}/root") } if -d "$o->{prefix}/root";
+ eval { commands::cp('-f', "/tmp/ddebug.log", "$o->{prefix}/root") } if -d "$o->{prefix}/root" && !$::testing;
$o->{steps}{$step}{reachable} = $o->{steps}{$step}{redoable};