diff options
Diffstat (limited to 'perl-install/fs/mount_point.pm')
-rw-r--r-- | perl-install/fs/mount_point.pm | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/perl-install/fs/mount_point.pm b/perl-install/fs/mount_point.pm index 6db7575ea..56f2405e9 100644 --- a/perl-install/fs/mount_point.pm +++ b/perl-install/fs/mount_point.pm @@ -1,4 +1,4 @@ -package fs::mount_point; # $Id$ +package fs::mount_point; use diagnostics; use strict; @@ -13,16 +13,21 @@ sub guess_mount_point { my %l = ( '/' => 'etc/fstab', '/boot' => 'vmlinuz', + '/boot' => 'vmlinux', + '/boot' => 'uImage', '/tmp' => '.X11-unix', '/usr' => 'src', - '/var' => 'catman', + '/var' => 'spool', ); my $handle = any::inspect($part, $prefix) or return; my $d = $handle->{dir}; my $mnt = find { -e "$d/$l{$_}" } keys %l; $mnt ||= (stat("$d/.bashrc"))[4] ? '/root' : '/home/user' . ++$$user if -e "$d/.bashrc"; - $mnt ||= (any { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bashrc" } glob_($d)) ? '/home' : ''; + $mnt ||= (any { -d $_ && (stat($_))[4] >= 1000 && -e "$_/.bashrc" } glob_($d)) ? '/home' : ''; + # Keep uid 500 here for guesswork, but base it on .bash_history to increase + # changes it's a real user. + $mnt ||= (any { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bash_history" } glob_($d)) ? '/home' : ''; ($mnt, $handle); } @@ -41,30 +46,32 @@ sub suggest_mount_points { #- try to find other mount points via fstab fs::merge_info_from_fstab($fstab, $handle->{dir}, $uniq, 'loose') if $mnt eq '/'; } + # reuse existing ESP under UEFI: + my @ESP = if_(is_uefi(), grep { isESP($_) } @$fstab); + if (@ESP) { + $ESP[0]{mntpoint} = '/boot/EFI'; + delete $ESP[0]{unsafeMntpoint}; + } $_->{mntpoint} and log::l("suggest_mount_points: $_->{device} -> $_->{mntpoint}") foreach @$fstab; } sub suggest_mount_points_always { my ($fstab) = @_; - my @win = grep { isFat_or_NTFS($_) && maybeFormatted($_) && !$_->{is_removable} && $_->{pt_type} != 0x12 && !isRecovery($_)} @$fstab; + my @ESP = if_(is_uefi(), grep { isESP($_) && maybeFormatted($_) && !$_->{is_removable} } @$fstab); + if (@ESP) { + $ESP[0]{mntpoint} = "/boot/EFI"; + } + my @win = grep { isnormal_Fat_or_NTFS($_) && !$_->{isMounted} && maybeFormatted($_) && !$_->{is_removable} } @$fstab; log::l("win parts: ", join ",", map { $_->{device} } @win) if @win; if (@win == 1) { - #- Suggest /boot/efi on ia64. - $win[0]{mntpoint} = arch() =~ /ia64/ ? "/boot/efi" : "/media/windows"; + $win[0]{mntpoint} = "/media/windows"; } else { my %w; foreach (@win) { my $v = $w{$_->{device_windobe}}++; $_->{mntpoint} = $_->{unsafeMntpoint} = "/media/win_" . lc($_->{device_windobe}) . ($v ? $v+1 : ''); #- lc cuz of StartOffice(!) cf dadou } } - - my @sunos = grep { $_->{pt_type} == 2 } @$fstab; #- take only into account root partitions. - if (@sunos) { - my $v = ''; - map { $_->{mntpoint} = $_->{unsafeMntpoint} = "/mnt/sunos" . ($v && ++$v) } @sunos; - } - #- a good job is to mount SunOS root partition, and to use mount point described here in /etc/vfstab. } sub validate_mount_points { @@ -80,8 +87,8 @@ sub validate_mount_points { $m{$m} and die N("Duplicate mount point %s", $m); $m{$m} = 1; - #- in case the type does not correspond, force it to ext3 - fs::type::set_fs_type($_, 'ext3') if !isTrueFS($_) && !isOtherAvailableFS($_); + #- in case the type does not correspond, force it to default fs (ext4 currently) + fs::type::set_fs_type($_, defaultFS()) if !isTrueFS($_) && !isOtherAvailableFS($_); } 1; } |