summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/fsedit.pm7
-rw-r--r--perl-install/install2.pm24
-rw-r--r--perl-install/partition_table.pm1
-rw-r--r--perl-install/partition_table_raw.pm8
-rw-r--r--perl-install/partition_table_sun.pm33
5 files changed, 66 insertions, 7 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 5997bcd0d..fee66e427 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -20,11 +20,16 @@ use log;
#- Globals
#-#####################################################################################
my @suggestions = (
+arch() =~ /^sparc/ ? (
+ { mntpoint => "/", size => 50 << 11, type => 0x83, ratio => 1, maxsize => 1000 << 11 },
+ { mntpoint => "swap", size => 30 << 11, type => 0x82, ratio => 1, maxsize => 500 << 11 },
+) : (
arch() =~ /^i386/ ? (
{ mntpoint => "/boot", size => 16 << 11, type => 0x83, maxsize => 30 << 11 },
) : (),
{ mntpoint => "/", size => 50 << 11, type => 0x83, ratio => 1, maxsize => 300 << 11 },
{ mntpoint => "swap", size => 30 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 },
+),
{ mntpoint => "/usr", size => 200 << 11, type => 0x83, ratio => 6, maxsize =>1500 << 11 },
{ mntpoint => "/home", size => 50 << 11, type => 0x83, ratio => 3 },
{ mntpoint => "/var", size => 200 << 11, type => 0x83, ratio => 1, maxsize =>1000 << 11 },
@@ -38,7 +43,9 @@ my @partitions_signatures = (
[ 0x83, 0x438, "\x53\xEF" ],
[ 0x82, 4086, "SWAP-SPACE" ],
[ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ],
+arch() !~ /^sparc/ ? (
[ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ],
+) : (),
);
sub typeOfPart($) { typeFromMagic(devices::make($_[0]), @partitions_signatures) }
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 5d3a0945d..2bcd3ba97 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -89,6 +89,27 @@ my @install_classes = (__("beginner"), __("developer"), __("server"), __("expert
#-#####################################################################################
#- partition layout
my %suggestedPartitions = (
+arch() =~ /^sparc/ ? (
+ normal => [
+ { mntpoint => "/", size => 600 << 11, type => 0x83, ratio => 5, maxsize =>1000 << 11 },
+ { mntpoint => "swap", size => 128 << 11, type => 0x82, ratio => 1, maxsize => 400 << 11 },
+ { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 4, maxsize =>1500 << 11 },
+ { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 2 },
+ ],
+ developer => [
+ { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 1, maxsize =>1000 << 11 },
+ { mntpoint => "swap", size => 128 << 11, type => 0x82, ratio => 1, maxsize => 400 << 11 },
+ { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 4, maxsize =>1500 << 11 },
+ { mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 },
+ ],
+ server => [
+ { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 1, maxsize =>1000 << 11 },
+ { mntpoint => "swap", size => 128 << 11, type => 0x82, ratio => 2, maxsize => 800 << 11 },
+ { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 3, maxsize =>1500 << 11 },
+ { mntpoint => "/var", size => 100 << 11, type => 0x83, ratio => 4 },
+ { mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 },
+ ],
+) : (
normal => [
{ mntpoint => "/boot", size => 10 << 11, type => 0x83, maxsize => 30 << 11 },
{ mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize => 2500 << 11 },
@@ -110,6 +131,7 @@ my %suggestedPartitions = (
{ mntpoint => "/var", size => 100 << 11, type => 0x83, ratio => 4 },
{ mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 },
],
+),
);
#-#######################################################################################
@@ -643,7 +665,7 @@ sub main {
sync(); sync();
log::l("installation complete, leaving");
- print "\n" x 30;
+ print "\n" x 80;
}
#-######################################################################################
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 4702a1210..151353989 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -410,6 +410,7 @@ sub write($) {
}
$hd->write(0, $hd->{primary}{raw}, $hd->{primary}{info}) or die "writing of partition table failed";
+ #- should be fixed but a extended exist with no real extended partition, that blanks mbr!
foreach (@{$hd->{extended}}) {
# in case of extended partitions, the start sector must be local to the partition
$_->{normal}{local_start} = $_->{normal}{start} - $_->{start};
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm
index 668913d9c..e48cddce0 100644
--- a/perl-install/partition_table_raw.pm
+++ b/perl-install/partition_table_raw.pm
@@ -63,6 +63,7 @@ sub get_geometry($) {
ioctl(F, c::HDIO_GETGEO(), $g) or return;
my %geom; @geom{qw(heads sectors cylinders start)} = unpack "CCSL", $g;
+ $geom{totalcylinders} = $geom{cylinders};
{ geom => \%geom, totalsectors => $geom{heads} * $geom{sectors} * $geom{cylinders} };
}
@@ -72,8 +73,15 @@ sub openit($$;$) { sysopen $_[1], $_[0]{file}, $_[2] || 0; }
# cause kernel to re-read partition table
sub kernel_read($) {
my ($hd) = @_;
+ sync();
local *F; openit($hd, *F) or return 0;
+ sync(); sleep(1);
$hd->{rebootNeeded} = !ioctl(F, c::BLKRRPART(), 0);
+ sync(); sleep(1);
+ $hd->{rebootNeeded} = !ioctl(F, c::BLKRRPART(), 0);
+ sync();
+ close F;
+ sync(); sleep(1);
}
sub zero_MBR($) {
diff --git a/perl-install/partition_table_sun.pm b/perl-install/partition_table_sun.pm
index 9ffa008a8..26371e598 100644
--- a/perl-install/partition_table_sun.pm
+++ b/perl-install/partition_table_sun.pm
@@ -51,9 +51,22 @@ sub adjustStart($$) {
#- since partition must always start on cylinders boundaries on sparc,
#- note that if start sector is on the first cylinder, it is adjusted
- #- to 0 and it is valid.
- $part->{start} = $part->{start} >= $hd->cylinder_size() ? round_up($part->{start}, $hd->cylinder_size()) : 0;
+ #- to 0 and it is valid, maybe not in fact, problem with Sun disk label.
+ #- IT COULD HURT IF STARTING AT 0, MAYBE THERE ARE SOME FLAGS FOR EXT2
+ #- TO AVOID WRITING ANYTHING ON THE FIRST 1024 BYTES OF DISK, ELSE PROM
+ #- MAY ERASE EVERYTHING... TO BE CHECKED LATER.
+ #- so now, starting on cylinder 1 is perfect altough it waste some disk space !
+ $part->{start} = round_down($part->{start}, $hd->cylinder_size());
+ $part->{start} = $hd->cylinder_size() if $part->{start} == 0;
$part->{size} = $end - $part->{start};
+ $part->{size} = $hd->cylinder_size() if $part->{size} <= 0;
+}
+sub adjustEnd($$) {
+ my ($hd, $part) = @_;
+ my $end = $part->{start} + $part->{size};
+ my $end2 = round_up($end, $hd->cylinder_size());
+ $end2 = $hd->{geom}{cylinders} * $hd->cylinder_size() if $end2 > $hd->{geom}{cylinders} * $hd->cylinder_size();
+ $part->{size} = $end2 - $part->{start};
}
#- compute crc checksum used for Sun Label partition, expect
@@ -103,6 +116,7 @@ sub read($$) {
# for each entry, it uses fields: start, size, type, active
sub write($$$;$) {
my ($hd, $sector, $pt, $info) = @_;
+# my ($csize, $wdsize) = (0, 0);
#- handle testing for writing partition table on file only!
local *F;
@@ -116,10 +130,15 @@ sub write($$$;$) {
($info->{infos}, $info->{partitions}) = map { join '', @$_ } list2kv map {
$_->{start} % $hd->cylinder_size() == 0 or die "partition not at beginning of cylinder";
+# $csize += $_->{size} if $_->{type} != 5;
+# $wdsize += $_->{size} if $_->{type} == 5;
+ $_->{flags} |= 0x10 if $_->{mntpoint} eq '/';
+ $_->{flags} |= 0x01 if partition_table::isSwap($_);
# local $_->{type} = $typeFromDos{$_->{type}} || $_->{type};
local $_->{start_cylinder} = $_->{start} / $hd->cylinder_size() - $sector;
pack($format1, @$_{@$fields1}), pack($format2, @$_{@$fields2});
} @$pt;
+# $csize == $wdsize or die "partitions are not using whole disk space";
#- compute the checksum by building the buffer to write and call compute_crc.
#- set csum to 0 so compute_crc will give the right csum value.
@@ -128,6 +147,8 @@ sub write($$$;$) {
syswrite F, pack($main_format, @$info{@$main_fields}), psizeof($main_format) or return 0;
+ sync();
+
1;
}
@@ -135,8 +156,8 @@ sub info {
my ($hd) = @_;
#- take care of reduction of the number of cylinders, avoid loop of reduction!
- unless ($hd->{geom}{total_cylinders} > $hd->{geom}{cylinders}) {
- $hd->{geom}{total_cylinders} = $hd->{geom}{cylinders};
+ unless ($hd->{geom}{totalcylinders} > $hd->{geom}{cylinders}) {
+ $hd->{geom}{totalcylinders} = $hd->{geom}{cylinders};
$hd->{geom}{cylinders} -= 2;
#- rebuild some constants according to number of cylinders.
@@ -149,11 +170,11 @@ sub info {
my $info = {
info => "DiskDrake partition table",
rspeed => 5400,
- pcylcount => $hd->{geom}{total_cylinders},
+ pcylcount => $hd->{geom}{totalcylinders},
sparecyl => 0,
ilfact => 1,
ncyl => $hd->{geom}{cylinders},
- nacyl => $hd->{geom}{total_cylinders} - $hd->{geom}{cylinders},
+ nacyl => $hd->{geom}{totalcylinders} - $hd->{geom}{cylinders},
ntrks => $hd->{geom}{heads},
nsect => $hd->{geom}{sectors},
magic => $magic,