package fsedit; # $Id$
use diagnostics;
use strict;
use vars qw(%suggestions);
#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use partition_table qw(:types);
use partition_table::raw;
use detect_devices;
use fsedit;
use devices;
use loopback;
use log;
use fs;
%suggestions = (
N_("simple") => [
{ mntpoint => "/", size => 300 << 11, type =>0x483, ratio => 5, maxsize => 5500 << 11 },
{ mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 },
{ mntpoint => "/home", size => 300 << 11, type =>0x483, ratio => 3 },
], N_("with /usr") => [
{ mntpoint => "/", size => 150 << 11, type =>0x483, ratio => 1, maxsize => 1000 << 11 },
{ mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 },
{ mntpoint => "/usr", size => 300 << 11, type =>0x483, ratio => 4, maxsize => 4000 << 11 },
{ mntpoint => "/home", size => 100 << 11, type =>0x483, ratio => 3 },
], N_("server") => [
{ mntpoint => "/", size => 150 << 11, type =>0x483, ratio => 1, maxsize => 250 << 11 },
{ mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 2, maxsize => 400 << 11 },
{ mntpoint => "/usr", size => 300 << 11, type =>0x483, ratio => 4, maxsize => 4000 << 11 },
{ mntpoint => "/var", size => 150 << 11, type =>0x483, ratio => 3 },
{ mntpoint => "/home", size => 150 << 11, type =>0x483, ratio => 3 },
{ mntpoint => "/tmp", size => 150 << 11, type =>0x483, ratio => 2, maxsize => 500 << 11 },
],
);
foreach (values %suggestions) {
if (arch() =~ /ia64/) {
@$_ = ({ mntpoint => "/boot/efi", size => 50 << 11, type => 0xb, ratio => 1, maxsize => 150 << 11 }, @$_);
}
}
my @suggestions_mntpoints = (
"/var/ftp", "/var/www", "/boot",
arch() =~ /sparc/ ? "/mnt/sunos" : arch() =~ /ppc/ ? "/mnt/macos" : "/mnt/windows",
#- RedHat also has /usr/local and /opt
);
my @partitions_signatures = (
[ 0x8e, 0, "HM\1\0" ],
[ 0x83, 0x438, "\x53\xEF" ],
[ 0x183, 0x10034, "ReIsErFs" ],
[ 0x183, 0x10034, "ReIsEr2Fs" ],
[ 0x283, 0, 'XFSB', 0x200, 'XAGF', 0x400, 'XAGI' ],
[ 0x383, 0x8000, 'JFS1' ],
[ 0x82, 4086, "SWAP-SPACE" ],
[ 0x82, 4086, "SWAPSPACE2" ],
[ 0x7, 0x1FE, "\x55\xAA", 0x3, "NTFS" ],
[ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ],
if_(arch() !~ /^sparc/,
[ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ],
),
);
sub typeOfPart {
my $dev = devices::make($_[0]);
my $t = typeFromMagic($dev, @partitions_signatures);
if ($t == 0x83) {
#- there is no magic to differentiate ext3 and ext2. Using libext2fs
#- to check if it has a journal
$t = 0x483 if c::is_ext3($dev);
}
$t;
}
#-######################################################################################
#- Functions
|