summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-12-05 12:21:11 +0000
committerOlivier Blin <oblin@mandriva.org>2005-12-05 12:21:11 +0000
commit18b3daec2bb7a5c7a6bccf6a7f73708741355bec (patch)
treea62a38b3dc1be2b3b5903ee688f6947967ecfff6
parent6c4497397a7334e91d57df6d20f1774dea88cfbb (diff)
downloaddrakx-18b3daec2bb7a5c7a6bccf6a7f73708741355bec.tar
drakx-18b3daec2bb7a5c7a6bccf6a7f73708741355bec.tar.gz
drakx-18b3daec2bb7a5c7a6bccf6a7f73708741355bec.tar.bz2
drakx-18b3daec2bb7a5c7a6bccf6a7f73708741355bec.tar.xz
drakx-18b3daec2bb7a5c7a6bccf6a7f73708741355bec.zip
add support for writable sparse loopbacks
-rwxr-xr-xtools/draklive21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/draklive b/tools/draklive
index 30999e123..770900a6d 100755
--- a/tools/draklive
+++ b/tools/draklive
@@ -163,6 +163,18 @@ my %loop = (
@mnt;
} },
},
+ sparsefs => {
+ modules => [],
+ create => sub {
+ my ($dest) = @_;
+ run_('dd', "of=$dest", 'count=0', 'seek=1000000', 'bs=1k');
+ run_('mke2fs', '-F', $dest);
+ },
+ mount => sub {
+ my ($live, $dir) = @_;
+ "mount -t ext2 $live->{media}{mountpoint}/$dir->{source} none $dir->{mountpoint}";
+ },
+ },
tmpfs => {
mount => sub {
my ($_live, $dir) = @_;
@@ -395,6 +407,11 @@ sub create_loopback_files {
unlink($dest);
$loop{$_->{type}}{build}->($tree, $dest);
}
+ foreach (grep { $_->{pre_create} } @{$live->{mount}{dirs} || []}) {
+ my $dest = $live->{images_dir} . '/' . $_->{source};
+ unlink($dest);
+ $loop{$_->{type}}{create}->($dest);
+ }
}
sub get_media_label {
@@ -446,9 +463,9 @@ sub record_master {
cp_f(glob($live->{boot_dir} . '/*'), $live->{mnt});
output($live->{mnt} . '/syslinux.cfg', build_syslinux_cfg($live));
unless ($o_refresh_boot_only) {
- foreach (grep { $_->{build_from} } @{$live->{mount}{dirs} || []}) {
+ foreach (grep { $_->{build_from} || $_->{pre_create} } @{$live->{mount}{dirs} || []}) {
print "copying $_->{source}\n";
- cp_f($live->{images_dir} . '/' . $_->{source}, $live->{mnt});
+ run_('cp', '-f', $live->{images_dir} . '/' . $_->{source}, $live->{mnt});
}
}
run_('umount', $live->{mnt});