diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-10-28 21:03:19 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-10-28 21:03:19 +0000 |
commit | d87a28c214c74a4611c61e157722dbe7e4710529 (patch) | |
tree | 48d92a7f827e705ab77bea22ce6aac7596a30ecb /lib/MDV | |
parent | ef64a367150c060b49b163db3a4383e68d3d3265 (diff) | |
download | drakiso-d87a28c214c74a4611c61e157722dbe7e4710529.tar drakiso-d87a28c214c74a4611c61e157722dbe7e4710529.tar.gz drakiso-d87a28c214c74a4611c61e157722dbe7e4710529.tar.bz2 drakiso-d87a28c214c74a4611c61e157722dbe7e4710529.tar.xz drakiso-d87a28c214c74a4611c61e157722dbe7e4710529.zip |
move storage_fs in new MDV::Draklive::StorageFS
Diffstat (limited to 'lib/MDV')
-rw-r--r-- | lib/MDV/Draklive/StorageFS.pm | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/MDV/Draklive/StorageFS.pm b/lib/MDV/Draklive/StorageFS.pm new file mode 100644 index 0000000..5181bae --- /dev/null +++ b/lib/MDV/Draklive/StorageFS.pm @@ -0,0 +1,56 @@ +package MDV::Draklive::StorageFS; + +use MDK::Common; + +my %storage_fs; +%storage_fs = ( + generic => { + mount => sub { + my ($live, $media) = @_; + my @mount_options = ( + if_($media->get_media_setting('read_only'), "ro"), + grep { $_ } $media->get_media_setting('mount_options'), + ); + 'nash-mount' . if_(@mount_options, " -o " . join(",", @mount_options)) . " -t " . $media->get_media_setting('fs') . + " " . $media->get_media_source_for_nash . " $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}"; + }, + }, + nfs => { + files => [ '/sbin/ifconfig', '/bin/mount' ], #- needed to mount NFS (with nolock) + mount => sub { + my ($live, $media) = @_; + '/bin/mount -n -o ro,nolock -t nfs ' . $media->get_media_source_for_nash . " $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}"; + } + }, + ext2 => { + files => [ '/sbin/fsck.ext2' ], + mount => sub { + my ($live, $media) = @_; + my $fsck = "/bin/fsck.ext2"; + my $source = $media->get_media_setting('source'); + qq(sh -c '$fsck -a $source || $fsck -y $source'), + $storage_fs{generic}{mount}->($live, $media); + }, + }, + vfat => { + #files => [ '/sbin/dosfsck' ], + mount => sub { + my ($live, $media) = @_; + #$storage_fs{generic}{mount}->($live, $media), + #qq(awk '\$2 == "$live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}" { system("umount " \$1 "; mount; echo dosfsck -a " \$1 "; dosfsck -a " \$1) }' /proc/mounts), + $storage_fs{generic}{mount}->($live, $media); + }, + }, +); + +sub get_files { + my ($fs) = @_; + @{$storage_fs{$fs} && $storage_fs{$fs}{files} || []}; +} + +sub get_mount { + my ($fs) = @_; + $storage_fs{exists $storage_fs{$fs}{mount} ? $fs : 'generic'}{mount}; +} + +1; |