From 0f89517d418ff907fd9cf51f5313974812ceb305 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 24 Nov 2019 00:45:03 +0100 Subject: Fix: Move LZO compressor from libsquashfs to libcommon The liblzo2 library is licensed under GPLv2, so it is not possible to distribute binaries of libsquashfs that link against liblzo2 under LGPL. This commit moves the LZO compressor implementation to libcommon, where this isn't a problem, since the tools themselves are licensed under GPLv3. It removes the ability of libsquashfs to read or generate LZO compressed SquashFS images, but the tools still can. Signed-off-by: David Oberhollenzer --- unpack/Makemodule.am | 1 + unpack/rdsquashfs.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'unpack') diff --git a/unpack/Makemodule.am b/unpack/Makemodule.am index b137787..16d7ce1 100644 --- a/unpack/Makemodule.am +++ b/unpack/Makemodule.am @@ -3,5 +3,6 @@ rdsquashfs_SOURCES += unpack/list_files.c unpack/options.c rdsquashfs_SOURCES += unpack/restore_fstree.c unpack/describe.c rdsquashfs_SOURCES += unpack/fill_files.c unpack/dump_xattrs.c rdsquashfs_LDADD = libcommon.a libcompat.a libsquashfs.la libutil.la +rdsquashfs_LDADD += $(LZO_LIBS) bin_PROGRAMS += rdsquashfs diff --git a/unpack/rdsquashfs.c b/unpack/rdsquashfs.c index 4acc71e..3cce318 100644 --- a/unpack/rdsquashfs.c +++ b/unpack/rdsquashfs.c @@ -35,7 +35,14 @@ int main(int argc, char **argv) goto out_file; } - if (!sqfs_compressor_exists(super.compression_id)) { + ret = sqfs_compressor_exists(super.compression_id); + +#ifdef WITH_LZO + if (super.compression_id == SQFS_COMP_LZO) + ret = true; +#endif + + if (!ret) { fprintf(stderr, "%s: unknown compressor used.\n", opt.image_name); goto out_file; @@ -46,6 +53,12 @@ int main(int argc, char **argv) SQFS_COMP_FLAG_UNCOMPRESS); cmp = sqfs_compressor_create(&cfg); + +#ifdef WITH_LZO + if (super.compression_id == SQFS_COMP_LZO && cmp == NULL) + cmp = lzo_compressor_create(&cfg); +#endif + if (cmp == NULL) { fputs("Error creating compressor.\n", stderr); goto out_file; -- cgit v1.2.3