diff options
Diffstat (limited to 'lib/MDV')
-rw-r--r-- | lib/MDV/Draklive/Loopback.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/MDV/Draklive/Loopback.pm b/lib/MDV/Draklive/Loopback.pm index 6fb592d..27ee20d 100644 --- a/lib/MDV/Draklive/Loopback.pm +++ b/lib/MDV/Draklive/Loopback.pm @@ -15,7 +15,7 @@ our %loop_types; squashfs => { read_only => 1, is_loopback => 1, - modules => [ qw(loop squashfs) ], + modules => sub { "loop", has_squashfs4_with_lzma($_[0]) ? "squashfs" : "squashfs_lzma" }, extension => '-lzma.sqfs', build => sub { my ($live, $dir) = @_; @@ -29,14 +29,16 @@ our %loop_types; my $exclude_file = tmpnam(); output_p($exclude_file, map { $root . "$_\n" } grep { -e $root . $_ } @{$dir->{exclude} || []}); my $sort = $live->{settings}{config_root} . '/' . $dir->{sort}; + my $squashfs4 = has_squashfs4_with_lzma($live); run_foreach(sub { if (/^mksquashfs: file .*, uncompressed size (\d+) bytes\s*(?:DUPLICATE|LINK)?$/) { $progress->{current} += $1; $progress->show(time()); } }, - 'mksquashfs', $src, $dest, '-noappend', '-comp', 'lzma', - '-b', '1048576', + $squashfs4 ? 'mksquashfs' : 'mksquashfs3', $src, $dest, + $squashfs4 ? ('-comp', 'lzma') : '-lzma', + '-noappend', '-b', '1048576', #'-processors', 1, '-ef', $exclude_file, if_(-f $sort, '-sort', $sort), @@ -131,4 +133,10 @@ sub get_loop_modules { (); } +sub has_squashfs4_with_lzma { + my ($live) = @_; + my $kernel = $live->find_kernel; + cat_($live->get_system_root . "/boot/config-" . $live->find_kernel->{version}) =~ /^CONFIG_DECOMPRESS_LZMA_NEEDED=y$/m; +} + 1; |