diff options
Diffstat (limited to 'perl-install/fs/mount.pm')
| -rw-r--r-- | perl-install/fs/mount.pm | 46 | 
1 files changed, 30 insertions, 16 deletions
diff --git a/perl-install/fs/mount.pm b/perl-install/fs/mount.pm index baf1ce837..6afaa9260 100644 --- a/perl-install/fs/mount.pm +++ b/perl-install/fs/mount.pm @@ -1,4 +1,4 @@ -package fs::mount; # $Id$ +package fs::mount;  use diagnostics;  use strict; @@ -35,12 +35,12 @@ sub mount {      $fs or log::l("not mounting $dev partition"), return;      { -	my @fs_modules = qw(ext3 hfs jfs nfs ntfs romfs reiserfs ufs xfs vfat); -	my @types = (qw(ext2 proc sysfs usbfs usbdevfs iso9660 devfs devpts), @fs_modules); +	my @fs_modules = qw(btrfs ext3 ext4 f2fs hfs jfs nilfs2 nfs ntfs romfs reiserfs ufs xfs vfat); +	my @types = (qw(ext2 proc sysfs iso9660 devpts auto ntfs-3g), @fs_modules); -	push @types, 'smb', 'smbfs', 'davfs2' if !$::isInstall; +	push @types, 'smb', 'cifs', 'davfs2' if !$::isInstall; -	if (!member($fs, @types) && !$::move) { +	if (!member($fs, @types)) {  	    log::l("skipping mounting $dev partition ($fs)");  	    return;  	} @@ -72,11 +72,18 @@ sub mount {  	fsck_jfs($dev, $o_wait_message);      } elsif ($fs eq 'ext2' && !$b_rdonly) {  	fsck_ext2($dev, $o_wait_message); +    } elsif ($fs eq 'davfs2') { +	require fs::remote::davfs; +	# We have to store credentials in davfs2 secret file before mounting +	fs::remote::davfs::mountpoint_credentials_save($where, \@mount_opt); +	# username and password options should be handled by /etc/davfs2/secrets file +	@mount_opt = grep { !/^(username|password)=/ } @mount_opt;      }      push @mount_opt, 'ro' if $b_rdonly;      $o_wait_message->(N("Mounting partition %s", $dev)) if $o_wait_message; +    modules::load("fuse") if $::isInstall && $fs eq 'ntfs-3g' && ! -e '/dev/fuse';      run_program::run('mount', '-t', $fs, $dev, $where, if_(@mount_opt, '-o', join(',', @mount_opt))) or die N("mounting partition %s in directory %s failed", $dev, $where);  } @@ -115,16 +122,17 @@ sub umount {      run_program::run('umount', $mntpoint) or do {  	kill 15, fuzzy_pidofs('^fam\b'); -	run_program::run('umount', $mntpoint) or die N("error unmounting %s: %s", $mntpoint, $!); +	my $err; +	run_program::run('umount', '2>', \$err, $mntpoint) or die N("error unmounting %s: %s", $mntpoint, common::to_utf8($err));      }; -    substInFile { $_ = '' if /(^|\s)$mntpoint\s/ } '/etc/mtab'; #- do not care about error, if we can not read, we will not manage to write... (and mess mtab) +    substInFile { $_ = '' if /(^|\s)$mntpoint\s/ } '/etc/mtab'; #- do not care about error, if we cannot read, we will not manage to write... (and mess mtab)  }  sub part {      my ($part, $b_rdonly, $o_wait_message) = @_; -    log::l("mount_part: " . join(' ', map { "$_=$part->{$_}" } 'device', 'mntpoint', 'isMounted', 'real_mntpoint')); +    log::l("mount_part: " . join(' ', map { "$_=$part->{$_}" } 'device', 'mntpoint', 'isMounted', 'real_mntpoint', 'device_UUID'));      return if $part->{isMounted} && !($part->{real_mntpoint} && $part->{mntpoint}); @@ -153,8 +161,6 @@ sub part {  		set_loop($part);  		$options = join(',', grep { !/^(encryption=|encrypted$|loop$)/ } split(',', $options)); #- we take care of this, don't let it mount see it  	    } elsif (isLoopback($part)) { -		#- mount will take care, but we must help it -		devices::make("loop$_") foreach 0 .. 7;  		$options = join(',', uniq('loop', split(',', $options))); #- ensure the loop options is used  	    } elsif ($part->{options} =~ /encrypted/) {  		log::l("skip mounting $part->{device} since we do not have the encrypt_key"); @@ -166,16 +172,25 @@ sub part {  	    my $fs_type = $part->{fs_type};  	    if ($fs_type eq 'auto' && $part->{media_type} eq 'cdrom' && $::isInstall) {  		$fs_type = 'iso9660'; +	    } elsif ($fs_type eq 'ntfs-3g' && $::isInstall) { +		$fs_type = 'ntfs';  	    }  	    mount($dev, $mntpoint, $fs_type, $b_rdonly, $options, $o_wait_message); -	    if ($options =~ /usrquota|grpquota/ && $part->{fs_type} eq 'ext3') { +	    if ($options =~ /usrquota|grpquota/ && member($part->{fs_type}, qw(ext3 ext4))) {  		if (! find { -e "$mntpoint/$_" } qw(aquota.user aquota.group quota.user quota.group)) {  		    #- quotacheck will create aquota.user and/or aquota.group, -		    #- needed for quotas on ext3. +		    #- needed for quotas on ext3/ext4.  		    run_program::run('quotacheck', $mntpoint);  		}		  	    } +	    if (isLoopback($part) && $::isInstall) { +		#- since /etc/mtab is symlinked to /proc/mounts, umount will +		#- not be able to know it needs to do losetup -d +		#- TODO: drop this and have a real /etc/mtab +		$part->{real_device} = cat_("/proc/mounts") =~ m!(/dev/\S+)\s+\Q$mntpoint\E\s! && $1; +		log::l("XXX $part->{real_device}"); +	    }  	}      }      $part->{isMounted} = 1; @@ -206,16 +221,15 @@ sub umount_all {      log::l("unmounting all filesystems");      foreach (sort { $b->{mntpoint} cmp $a->{mntpoint} }  -	       grep { $_->{mntpoint} && !$_->{real_mntpoint} } @$fstab) { +	       grep { $_->{mntpoint} && !$_->{real_mntpoint} || isSwap($_) } @$fstab) {  	umount_part($_);      }  } -sub usbfs { +sub sys_kernel_debug {      my ($prefix) = @_; -    my $fs = cat_('/proc/filesystems') =~ /usbfs/ ? 'usbfs' : 'usbdevfs'; -    mount('none', "$prefix/proc/bus/usb", $fs); +    mount('none', "$prefix/sys/kernel/debug/usb", 'debugfs');  }  1;  | 
