From 14da6683acda76b094c886508c79dc78fbb5be11 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 29 Oct 2008 00:57:05 +0000 Subject: extract predefined and custom mounts/fs in MDV::Draklive::Mounts and MDV::Draklive::CustomMedia modules (breaks config files) --- lib/MDV/Draklive/CustomMedia.pm | 14 +++++++ lib/MDV/Draklive/Mounts.pm | 87 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 lib/MDV/Draklive/CustomMedia.pm create mode 100644 lib/MDV/Draklive/Mounts.pm (limited to 'lib/MDV') diff --git a/lib/MDV/Draklive/CustomMedia.pm b/lib/MDV/Draklive/CustomMedia.pm new file mode 100644 index 0000000..21750cd --- /dev/null +++ b/lib/MDV/Draklive/CustomMedia.pm @@ -0,0 +1,14 @@ +package MDV::Draklive::CustomMedia; + +sub nfs_media { + my ($module, $client, $path) = @_; + ( + fs => 'nfs', + modules => 'nfs', + extra_modules => [ $module ], + pre => "ifconfig eth0 $client up", + source => $path, + ); +} + +1; diff --git a/lib/MDV/Draklive/Mounts.pm b/lib/MDV/Draklive/Mounts.pm new file mode 100644 index 0000000..f7d630f --- /dev/null +++ b/lib/MDV/Draklive/Mounts.pm @@ -0,0 +1,87 @@ +package MDV::Draklive::Mounts; + +use MDK::Common; + +my $_dir_distrib_sqfs = { + mountpoint => '/distrib', + type => 'squashfs', + path => '/distrib', + # perl -MMDK::Common -e 'print map_index { (32767 - $::i) . " $_" } grep { !m,^/(?:dev|proc|sys|live/distrib), } uniq(<>)' < bootlog.list > config/distrib.sort + sort => "config/distrib.sort", + build_from => '/', +}; +my $_dir_memory = { + mountpoint => '/memory', + type => 'tmpfs', +}; + +my $_dir_modules = { + mountpoint => '/modules', + type => 'modules', + path => '/modules', + list => 'modules.lst', +}; + +our $simple_union = { + root => '/union', + overlay => 'unionfs', + dirs => [ + { + mountpoint => '/media', + type => 'plain', + }, + $_dir_memory, + ], + }; + +our $squash_rw_union = { + root => '/union', + overlay => 'unionfs', + dirs => [ + $_dir_distrib_sqfs, + { + mountpoint => '/media/system', + type => 'plain', + }, + ], + }; + +sub volatile_squash_union { + my ($o_modules) = @_; + { + root => '/union', + overlay => 'unionfs', + dirs => [ + $_dir_distrib_sqfs, + if_($o_modules, $_dir_modules), + $_dir_memory, + ], + }; +} + +sub squash_union { + my ($default_size, $o_min_size, $o_modules) = @_; + { + root => '/union', + overlay => 'unionfs', + dirs => [ + $_dir_distrib_sqfs, + if_($o_modules, $_dir_modules), + { + mountpoint => '/system', + type => 'loopfs', + pre_allocate => $default_size, + if_(defined $o_min_size, min_size => $o_min_size), + fs => 'ext2', + path => '/system' + }, + { + mountpoint => '/system', + type => 'tmpfs', + fallback => 1, + }, + ], + }; +} + +1; -- cgit v1.2.1