summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-28 08:50:21 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-28 08:50:21 +0000
commit719eb7e1d3fb874a83658190c481285763c51249 (patch)
tree6bcde3502817d168609ce3d81d09f76726c01263
parentd89f12733428f28ff0627b63c98a98bacdbf0701 (diff)
downloaddraklive-719eb7e1d3fb874a83658190c481285763c51249.tar
draklive-719eb7e1d3fb874a83658190c481285763c51249.tar.gz
draklive-719eb7e1d3fb874a83658190c481285763c51249.tar.bz2
draklive-719eb7e1d3fb874a83658190c481285763c51249.tar.xz
draklive-719eb7e1d3fb874a83658190c481285763c51249.zip
move mount actions in a storage_fs hash
-rwxr-xr-xdraklive29
1 files changed, 22 insertions, 7 deletions
diff --git a/draklive b/draklive
index 2c7fb40..6727060 100755
--- a/draklive
+++ b/draklive
@@ -145,6 +145,27 @@ my %storage = (
},
);
+my %storage_fs;
+%storage_fs = (
+ generic => {
+ mount => sub {
+ my ($live, $media) = @_;
+ my @mount_options = (
+ if_(get_media_setting($media, 'read_only'), "ro"),
+ grep { $_ } get_media_setting($media, 'mount_options'),
+ );
+ 'mount' . if_(@mount_options, " -o " . join(",", @mount_options)) . " -t " . get_media_setting($media, 'fs') .
+ " " . get_media_source_for_nash($media) . " $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}";
+ },
+ },
+ nfs => {
+ mount => sub {
+ my ($live, $media) = @_;
+ '/bin/mount -n -o ro,nolock -t nfs ' . get_media_source_for_nash($media) . " $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}";
+ }
+ },
+);
+
sub nls_modules {
my ($live) = @_;
if_(get_media_setting($live->{media}, 'fs') eq 'vfat', 'nls_cp437'), #- default FAT codepage
@@ -489,10 +510,6 @@ sub create_initrd_scriptlet {
my $fs = get_media_setting($media, 'fs');
my $rrpt_dev = get_media_setting($media, 'rereadpt');
my $debug_shell = "sh -c 'if grep -q debug /proc/cmdline; then exec sh </dev/console >/dev/console 2>/dev/console; fi'";
- my @mount_options = (
- if_(get_media_setting($media, 'read_only'), "ro"),
- grep { $_ } get_media_setting($media, 'mount_options'),
- );
my ($mount_first, $mount_last) = partition { !$loop{$_->{type}}{delay_mount} }
grep { exists $loop{$_->{type}}{mount} } @{$live->{mount}{dirs} || []};
@@ -514,9 +531,7 @@ sub create_initrd_scriptlet {
$debug_shell,
if_($pre, deref_array($pre)),
"mkdevices /dev",
- ($fs eq 'nfs' ? '/bin/mount -n -o ro,nolock' : 'mount') .
- if_(@mount_options, " -o " . join(",", @mount_options)) .
- " -t $fs " . get_media_source_for_nash($media, 'source') . " $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}",
+ $storage_fs{exists $storage_fs{$fs}{mount} ? $fs : 'generic'}{mount}->($live, $media),
(map { $loop{$_->{type}}{mount}->($live, $_) } @$mount_first, @$mount_last),
($live->{mount}{overlay} ? $overlay{$live->{mount}{overlay}}{mount}->($live) : ()),
"echo 0x0100 > /proc/sys/kernel/real-root-dev",