summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-10-08 22:00:52 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-10-08 22:00:52 +0000
commitfc479b2a46849ffe42eb17a3162a38e27900fe93 (patch)
tree571baaa9ab25ea06b356db9ede64b51a0de5ae87 /perl-install
parented6bcf695365fcf77850639267fa3c3633429d86 (diff)
downloaddrakx-backup-do-not-use-fc479b2a46849ffe42eb17a3162a38e27900fe93.tar
drakx-backup-do-not-use-fc479b2a46849ffe42eb17a3162a38e27900fe93.tar.gz
drakx-backup-do-not-use-fc479b2a46849ffe42eb17a3162a38e27900fe93.tar.bz2
drakx-backup-do-not-use-fc479b2a46849ffe42eb17a3162a38e27900fe93.tar.xz
drakx-backup-do-not-use-fc479b2a46849ffe42eb17a3162a38e27900fe93.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/common.pm14
-rw-r--r--perl-install/fsedit.pm6
-rw-r--r--perl-install/install2.pm14
-rw-r--r--perl-install/install_steps.pm37
-rw-r--r--perl-install/install_steps_interactive.pm24
-rw-r--r--perl-install/my_gtk.pm68
6 files changed, 68 insertions, 95 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index f2d458a26..9dc3e3c6a 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -359,11 +359,15 @@ sub typeFromMagic($@) {
local *F; sysopen F, $f, 0 or return;
my $tmp;
- foreach (@_) {
- my ($name, $offset, $signature) = @$_;
- sysseek(F, $offset, 0) or next;
- sysread(F, $tmp, length $signature);
- $tmp eq $signature and return $name;
+ M: foreach (@_) {
+ my ($name, @l) = @$_;
+ while (@l) {
+ my ($offset, $signature) = splice(@l, 0, 2);
+ sysseek(F, $offset, 0) or next M;
+ sysread(F, $tmp, length $signature);
+ $tmp eq $signature or next M;
+ }
+ return $name;
}
undef;
}
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 6b7de468f..b0ec2a664 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -33,8 +33,10 @@ my @suggestions_mntpoints = qw(/mnt/dos);
my @partitions_signatures = (
- [ 0x83, 0x438, "\xEF\x53" ],
+ [ 0x83, 0x438, "\x53\xEF" ],
[ 0x82, 4086, "SWAP-SPACE" ],
+ [ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ],
+ [ 0x6, 0x1FE, "\x55\xAA", 0, "\xEB\x3C", 0x36, "FAT" ],
);
sub typeOfPart($) { typeFromMagic(devices::make($_[0]), @partitions_signatures) }
@@ -367,8 +369,8 @@ sub verifyHds {
if ($readonly && !$ok) {
log::l("using /proc/partitions as diskdrake failed :(");
foreach my $hd (@$hds) {
+ partition_table_raw::zero_MBR($hd);
$hd->{primary} = { normal => [ grep { $hd->{device} eq $_->{rootDevice} } @parts ] };
- delete $hd->{extended};
}
}
my $fstab = [ get_fstab(@$hds) ];
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 0c47f513f..2ac1d1430 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -117,7 +117,7 @@ my %suggestedPartitions = (
#-the variable $default)
#-#######################################################################################
$o = $::o = {
-# bootloader => { linear => 0, message => 1, keytable => 1, timeout => 5, restricted => 0 },
+# bootloader => { linear => 0, message => 1, timeout => 5, restricted => 0 },
autoSCSI => 0,
mkbootdisk => 1, #- no mkbootdisk if 0 or undef, find a floppy with 1
#- packages => [ qw() ],
@@ -269,7 +269,7 @@ sub partitionDisks {
return if ($o->{isUpgrade});
$::o->{steps}{formatPartitions}{done} = 0;
- fs::umount_all($o->{fstab}, $o->{prefix}) if $o->{fstab};
+ fs::umount_all($o->{fstab}, $o->{prefix}) if $o->{fstab} && !$::testing;
my $ok = is_empty_array_ref($o->{hds}) ? install_any::getHds($o) : 1;
my $auto = $ok && !$o->{partitioning}{readonly} &&
@@ -421,18 +421,12 @@ sub main {
$o->{partitioning}{auto_allocate} = 1;
} elsif (/--pcmcia/) {
$o->{pcmcia} = shift;
+ } elsif (/--readonly/) {
+ $o->{partitioning}{readonly} = 1;
}
}
- #- if this fails, it's okay -- it might help with free space though
- unlink "/sbin/install" unless $::testing;
- unlink "/sbin/cardmgr" unless $::testing;
unlink "/sbin/insmod" unless $::testing;
- unlink "/sbin/rmmod" unless $::testing;
- unlink "/modules/pcmcia_core.o" unless $::testing;
- unlink "/modules/i82365.o" unless $::testing;
- unlink "/modules/tcic.o" unless $::testing;
- unlink "/modules/ds.o" unless $::testing;
print STDERR "in second stage install\n";
log::openLog(($::testing || $o->{localInstall}) && 'debug.log');
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index d736aeee2..464e564ef 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -105,6 +105,27 @@ sub doPartitionDisks($$) {
}
#------------------------------------------------------------------------------
+
+sub ask_mntpoint_s {
+ my ($o, $fstab) = @_;
+
+ #- TODO: set the mntpoints
+
+ #- assure type is at least ext2
+ (fsedit::get_root($fstab) || {})->{type} = 0x83;
+
+ my %m; foreach (@$fstab) {
+ my $m = $_->{mntpoint} or next;
+
+ $m{$m} and die _("Duplicate mount point %s", $m);
+ $m{$m} = 1;
+
+ #- in case the type does not correspond, force it to ext2
+ $_->{type} = 0x83 if $m =~ m|^/| && !isDos($_) && !isWin($_)
+ }
+}
+
+
sub rebootNeeded($) {
my ($o) = @_;
log::l("Rebooting...");
@@ -114,11 +135,17 @@ sub rebootNeeded($) {
sub choosePartitionsToFormat($$) {
my ($o, $fstab) = @_;
- $_->{mntpoint} = "swap" foreach grep { isSwap($_) } @$fstab;
- $_->{toFormat} = $_->{mntpoint} &&
- (fsedit::typeOfPart($_->{device}) != $_->{type} ||
- $_->{notFormatted} ||
- $o->{partitioning}{autoformat}) foreach @$fstab;
+ foreach (@$fstab) {
+ $_->{mntpoint} = "swap" if isSwap($_);
+ $_->{mntpoint} or next;
+
+ unless ($_->{toFormat} = $_->{notFormatted} || $o->{partitioning}{autoformat}) {
+ my $t = fsedit::typeOfPart($_->{device});
+ $_->{toFormatUnsure} =
+ #- if detected dos/win, it's not precise enough to just compare the types (too many of them)
+ isDos({ type => $t }) || isWin({type => $t}) ? !isDos($_) && !isWin($_) : $t != $_->{type};
+ }
+ }
}
sub formatPartitions {
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 91943cd69..8498f6320 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -125,28 +125,28 @@ sub ask_mntpoint_s {
@fstab = grep { !isSwap($_) } @$fstab if @fstab == 0;
@fstab = @$fstab if @fstab == 0;
die _("no available partitions") if @fstab == 0;
+
+ my $msg = sub { "$_->{device} " . _("(%dMb)", $_->{size} / 1024 / 2) };
if (@fstab == 1) {
$fstab[0]->{mntpoint} = '/';
} elsif ($::beginner) {
- my %l; $l{"$_->{device} " . _("(%dMb)", $_->{size} / 1024 / 2)} = $_ foreach @fstab;
+ my %l; $l{&$msg} = $_ foreach @fstab;
my $e = $o->ask_from_list('',
_("Which partition do you want to use as your root partition"),
[ keys %l ]);
(fsedit::get_root($fstab) || {})->{mntpoint} = '';
$l{$e}{mntpoint} = '/';
} else {
- $o->ask_from_entries_ref('',
- _("Choose the mount points"),
- [ map { $_->{device} } @fstab ],
- [ map { \$_->{mntpoint} } @fstab ]);
+ $o->ask_from_entries_ref
+ ('',
+ _("Choose the mount points"),
+ [ map { &$msg } @fstab ],
+ [ map { +{ val => \$_->{mntpoint},
+ list => [ '', fsedit::suggestions_mntpoint([]) ]
+ } } @fstab ]);
}
- #- assure type is at least ext2
- (fsedit::get_root($fstab) || {})->{type} = 0x83;
-
- $_->{mntpoint} && $_->{mntpoint} =~ m|^/|
- && !isDos($_) && !isWin($_)
- and $_->{type} = 0x83 foreach @$fstab;
+ $o->SUPER::ask_mntpoint_s($fstab);
}
#------------------------------------------------------------------------------
@@ -166,6 +166,8 @@ sub choosePartitionsToFormat($$) {
return if $::beginner && 0 == grep { ! $_->{toFormat} } @l;
+ $_->{toFormat} ||= $_->{toFormatUnsure} foreach @l;
+
$o->ask_many_from_list_ref('', _("Choose the partitions you want to format"),
[ map { isSwap($_) ? type2name($_->{type}) . " ($_->{device})" : $_->{mntpoint} } @l ],
[ map { \$_->{toFormat} } @l ]) or die "cancel";
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index e84da88e2..ede3a2d78 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -367,7 +367,7 @@ sub _ask_from_entry($$@) {
sub _ask_from_list($$$$) {
my ($o, $messages, $l, $def) = @_;
my $list = new Gtk::CList(1);
- my ($first_time, $starting_word) = (1, '');
+ my ($first_time, $starting_word, $start_reg) = (1, '', "^");
my (@widgets, $timeout, $curr);
my $leave = sub { $o->{retval} = $l->[$curr]; Gtk->main_quit };
@@ -388,7 +388,10 @@ sub _ask_from_list($$$$) {
Gtk->timeout_remove($timeout) if $timeout; $timeout = '';
- if ($e->{keyval} >= 0x100) {
+ if ($e->{state} & 4) {
+ #- control pressed
+ $start_reg = $start_reg ? '' : "^" if $c eq "s";
+ } elsif ($e->{keyval} >= 0x100) {
&$leave if $c eq "\r" || $c eq "\x8d";
$starting_word = '';
} else {
@@ -399,7 +402,7 @@ sub _ask_from_list($$$$) {
my $word = quotemeta $starting_word;
my $j; for ($j = 0; $j < @$l; $j++) {
- $l->[($j + $curr) % @$l] =~ /^$word/i and last;
+ $l->[($j + $curr) % @$l] =~ /$start_reg$word/i and last;
}
$j == @$l ?
$starting_word = '' :
@@ -466,62 +469,3 @@ sub _ask_file($$) {
#- $w
#-}
-#-sub _ask_from_list($$$$) {
-#- my ($o, $messages, $l, $def) = @_;
-#- my $list = new Gtk::List();
-#- my ($first_time, $starting_word) = (1, '');
-#- my (@widgets, $timeout);
-#- $list->signal_connect(select_child => sub {
-#- $o->{retval} = $l->[$list->child_position($_[1])];
-#- Gtk->main_quit;
-#- });
-#- map_index {
-#- my ($i) = @_;
-#- $def = $i if $_ eq $def;
-#- my $w = new Gtk::ListItem($_);
-#- my $id = $w->signal_connect(key_press_event => sub {
-#- my ($w, $e) = @_;
-#- my $c = chr $e->{keyval};
-#-
-#- Gtk->timeout_remove($timeout) if $timeout; $timeout = '';
-#-
-#- if ($e->{keyval} >= 0x100) {
-#- if ($c eq "\r" || $c eq "\x8d") {
-#- $list->select_item($i);
-#- }
-#- $starting_word = '';
-#- } else {
-#- my $curr = $i + bool($starting_word eq '' || $starting_word eq $c);
-#- $starting_word .= $c unless $starting_word eq $c;
-#-
-#- my $j; for ($j = 0; $j < @$l; $j++) {
-#- $l->[($j + $curr) % @$l] =~ /^$starting_word/i and last;
-#- }
-#- $j == @$l ?
-#- $starting_word = '' :
-#- $widgets[($j + $curr) % @$l]->grab_focus;
-#-
-#- $w->{timeout} = $timeout = Gtk->timeout_add($forgetTime, sub { $timeout = $starting_word = ''; 0 } );
-#- }
-#- 1;
-#- });
-#- push @widgets, $w;
-#- } @$l;
-#- gtkadd($list, @widgets);
-#- my $scroll_win = do {
-#- if (@$l > 15) {
-#- my $win = createScrolledWindow($list);
-#- gtkset_usize($win, 200, 280);
-#- $list->set_focus_vadjustment($win->get_vadjustment);
-#- $list->set_focus_hadjustment($win->get_hadjustment);
-#- $win;
-#- } else {
-#- $list;
-#- }
-#- };
-#- gtkadd($o->{window},
-#- gtkpack($o->create_box_with_title(@$messages),
-#- $scroll_win));
-#- $widgets[$def]->grab_focus;
-#-
-#-}