summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/type.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/fs/type.pm')
-rw-r--r--perl-install/fs/type.pm37
1 files changed, 25 insertions, 12 deletions
diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm
index 0e17bbd00..bb90bdfe1 100644
--- a/perl-install/fs/type.pm
+++ b/perl-install/fs/type.pm
@@ -1,4 +1,4 @@
-package fs::type; # $Id: type.pm 257105 2009-04-27 15:22:01Z pterjan $
+package fs::type; # $Id: type.pm 269283 2010-05-24 15:31:58Z pterjan $
use diagnostics;
use strict;
@@ -9,8 +9,8 @@ use devices;
our @ISA = qw(Exporter);
our @EXPORT = qw(
- isEmpty isExtended isTrueLocalFS isTrueFS isDos isSwap isOtherAvailableFS isRawLVM isRawRAID isRAID isLVM isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isLoopback isMounted isBusy isSpecial isApple isAppleBootstrap isWholedisk isFat_or_NTFS
- maybeFormatted set_isFormatted
+ isEmpty isExtended isTrueLocalFS isTrueFS isDos isSwap isOtherAvailableFS isRawLVM isRawRAID isRawLUKS isRAID isLVM isLUKS isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isLoopback isMounted isBusy isSpecial isApple isAppleBootstrap isWholedisk isFat_or_NTFS isRecovery
+ maybeFormatted set_isFormatted defaultFS
);
@@ -22,6 +22,7 @@ my (%type_name2pt_type, %type_name2fs_type, %fs_type2pt_type, %pt_type2fs_type,
0x82 => 'swap', 'Linux swap',
0x83 => 'ext2', 'Linux native',
0x83 => 'ext3', 'Journalised FS: ext3',
+ 0x83 => 'ext4', 'Journalised FS: ext4',
0x83 => 'reiserfs', 'Journalised FS: ReiserFS',
if_(arch() =~ /ppc|i.86|ia64|x86_64/,
0x83 => 'xfs', 'Journalised FS: XFS',
@@ -120,8 +121,9 @@ if_(arch() !~ /ppc/,
0x81 => '', 'Minix / old Linux',
if_(!$::isInstall,
0x83 => 'reiser4', 'Journalised FS: Reiser4',
- 0x83 => 'ext4dev', 'Journalised FS: ext4',
+ 0x83 => 'nilfs2', 'NILFS2',
),
+ 0x83 => 'btrfs', 'Btrfs',
0x84 => '', 'OS/2 hidden C: drive',
0x86 => '', 'NTFS volume set (0x86)',
0x87 => '', 'NTFS volume set (0x87)',
@@ -183,7 +185,7 @@ if_(arch() !~ /ppc/,
sub type_names {
my ($expert, $o_hd) = @_;
my @l = @{$type_names{important}};
- push @l, @{$type_names{non_fs_type}};
+ push @l, grep { $_ ne 'Encrypted' } @{$type_names{non_fs_type}};
push @l, sort @{$type_names{other}} if $expert;
if ($o_hd && !$o_hd->use_pt_type) {
warn "$_ => $type_name2fs_type{$_}\n" foreach @l;
@@ -270,19 +272,19 @@ sub fs_type_from_magic {
}
}
-sub call_vol_id {
+sub call_blkid {
my ($part) = @_;
my %h = map {
if_(/(.*?)=(.*)/, $1 => $2);
- } run_program::get_stdout('vol_id', '2>', '/dev/null', devices::make($part->{device}));
+ } run_program::get_stdout('blkid', '2>', '/dev/null', '-o', 'udev', '-p', devices::make($part->{device}));
\%h;
}
sub type_subpart_from_magic {
my ($part) = @_;
- my $ids = call_vol_id($part);
+ my $ids = call_blkid($part);
my $p;
if ($ids->{ID_FS_USAGE} eq 'raid') {
@@ -297,19 +299,21 @@ sub type_subpart_from_magic {
$p = type_name2subpart('Encrypted');
} elsif (my $fs_type = $ids->{ID_FS_TYPE}) {
$fs_type = 'ntfs-3g' if $fs_type eq 'ntfs';
- $p = fs_type2subpart($fs_type) or log::l("unknown filesystem $fs_type returned by vol_id");
+ $p = fs_type2subpart($fs_type) or log::l("unknown filesystem $fs_type returned by blkid");
}
if ($p) {
$part->{fs_type_from_magic} = $p->{fs_type};
$p->{device_LABEL} = $ids->{ID_FS_LABEL} if $ids->{ID_FS_LABEL};
$p->{device_UUID} = $ids->{ID_FS_UUID} if $ids->{ID_FS_UUID};
- log::l("vol_id gave: $p->{fs_type} $p->{device_UUID} $p->{device_LABEL}");
+ log::l("blkid gave: $p->{fs_type} $p->{device_UUID} $p->{device_LABEL}");
}
$p;
}
-sub true_local_fs_types() { qw(ext3 ext2 ext4dev reiserfs reiser4 xfs jfs) }
+sub defaultFS { 'ext4' }
+
+sub true_local_fs_types() { qw(btrfs ext3 ext2 ext4 reiserfs reiser4 xfs jfs) }
sub isEmpty { !$_[0]{fs_type} && $_[0]{pt_type} == 0 }
sub isEfi { arch() =~ /ia64/ && $_[0]{pt_type} == 0xef }
@@ -323,6 +327,14 @@ sub isDos { arch() !~ /^sparc/ && ${{ 1 => 1, 4 => 1, 6 => 1 }}{$_[0]{pt_type}}
sub isFat_or_NTFS { member($_[0]{fs_type}, 'vfat', 'ntfs', 'ntfs-3g') }
sub isApple { $_[0]{pt_type} == 0x401 && defined $_[0]{isDriver} }
sub isAppleBootstrap { $_[0]{pt_type} == 0x401 && defined $_[0]{isBoot} }
+sub isRecovery {
+ isFat_or_NTFS($_[0]) && ($_[0]{type_name} =~ /^Hidden/ ||
+ member($_[0]{device_LABEL} ,
+ # Extracted from /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi
+ # Hopefuly we'll ask to hal/udev someday
+ 'RECOVERY', 'PQSERVICE', 'HP_RECOVERY', 'Recovery Partition', 'DellUtility', 'DellRestore', 'IBM_SERVICE', 'SERVICEV001', 'SERVICEV002')
+ )
+}
sub isTrueFS { isTrueLocalFS($_[0]) || member($_[0]{fs_type}, qw(nfs)) }
sub isTrueLocalFS { member($_[0]{fs_type}, true_local_fs_types()) }
@@ -341,9 +353,10 @@ sub isNonMountable {
sub isPartOfLVM { defined $_[0]{lvm} }
sub isPartOfRAID { defined $_[0]{raid} }
sub isPartOfLoopback { defined $_[0]{loopback} }
-sub isRAID { $_[0]{device} =~ /^md/ }
+sub isRAID { $_[0]{device} =~ /^md/ && defined $_[0]{level} }
sub isUBD { $_[0]{device} =~ /^ubd/ } #- should be always true during an $::uml_install
sub isLVM { $_[0]{VG_name} || $_[0]{lv_name} }
+sub isLUKS { defined $_[0]{dmcrypt_name} }
sub isLoopback { defined $_[0]{loopback_file} }
sub isMounted { $_[0]{isMounted} }
sub isBusy { isMounted($_[0]) || isPartOfRAID($_[0]) || isPartOfLVM($_[0]) || $_[0]{dm_active} || isPartOfLoopback($_[0]) }