diff -ur partimage-0.6.8/configure.ac partimage-0.6.8.new/configure.ac --- partimage-0.6.8/configure.ac 2009-09-24 22:00:40.000000000 +0200 +++ partimage-0.6.8.new/configure.ac 2009-09-26 00:24:47.000000000 +0200 @@ -89,6 +89,8 @@ fi AC_CHECK_LIB([bz2], [BZ2_bzopen], [], AC_MSG_ERROR([*** bzip2 library (libbz2) not found or too old: version 1.0.0 or more recent is need])) +AC_CHECK_LIB([lzmadec], [lzmadec_open], [], + AC_MSG_ERROR([*** lzmadec library not found or too old])) AC_CHECK_LIB([newt], [newtCenteredWindow], [], AC_MSG_ERROR([*** newt library (libnewt) not found])) AC_CHECK_LIB([z], [gzwrite], [], Only in partimage-0.6.8.new: configure.ac.orig diff -ur partimage-0.6.8/src/client/gui_text.cpp partimage-0.6.8.new/src/client/gui_text.cpp --- partimage-0.6.8/src/client/gui_text.cpp 2009-09-12 10:06:23.000000000 +0200 +++ partimage-0.6.8.new/src/client/gui_text.cpp 2009-09-26 00:24:47.000000000 +0200 @@ -902,6 +902,9 @@ SNPRINTF(szTemp, i18n("Compression level:................lzo")); SNPRINTF(szTemp2, i18n("lzo")); break; + case COMPRESS_LZMA: + SNPRINTF(szTemp, i18n("Compression level:................lzma")); + break; default: memset(szTemp2, 0, sizeof(szTemp2)); SNPRINTF(szTemp3, i18n("Compression level:................%s"),szTemp2); Only in partimage-0.6.8.new/src/client: gui_text.cpp.orig diff -ur partimage-0.6.8/src/client/image_net.h partimage-0.6.8.new/src/client/image_net.h --- partimage-0.6.8/src/client/image_net.h 2009-09-12 10:06:23.000000000 +0200 +++ partimage-0.6.8.new/src/client/image_net.h 2009-09-26 00:24:47.000000000 +0200 @@ -26,6 +26,7 @@ #include <zlib.h> // gzip compression #include <bzlib.h> // bzip2 compression +#include <lzmadec.h> // lzma compression #include <pthread.h> // ================================================ diff -ur partimage-0.6.8/src/client/imagefile.cpp partimage-0.6.8.new/src/client/imagefile.cpp --- partimage-0.6.8/src/client/imagefile.cpp 2009-09-24 21:21:42.000000000 +0200 +++ partimage-0.6.8.new/src/client/imagefile.cpp 2009-09-26 00:24:47.000000000 +0200 @@ -43,6 +43,7 @@ #include <zlib.h> // gzip compression #include <bzlib.h> // bzip2 compression +#include <lzmadec.h> // lzma compression CParam g_param; @@ -136,6 +137,7 @@ m_fImageFile = NULL; m_gzImageFile = NULL; m_bzImageFile = NULL; + m_lzmaImageFile = NULL; RETURN; } @@ -398,6 +400,8 @@ nRes = gzread(m_gzImageFile, cBuf, dwLength); else if (m_options.dwCompression == COMPRESS_BZIP2) nRes = BZ2_bzread(m_bzImageFile, cBuf, dwLength); + else if (m_options.dwCompression == COMPRESS_LZMA) + nRes = lzmadec_read(m_lzmaImageFile, (uint8_t *)cBuf, dwLength); else THROW(ERR_COMP); @@ -580,6 +584,8 @@ } else if (m_options.dwCompression == COMPRESS_BZIP2) // Bzip2 compression BZ2_bzclose(m_bzImageFile); + else if (m_options.dwCompression == COMPRESS_LZMA) // Lzma compression + lzmadec_close(m_lzmaImageFile); if (nRes) THROW(ERR_ERRNO, errno); @@ -611,6 +617,8 @@ nRes = gzclose(m_gzImageFile); else if (m_options.dwCompression == COMPRESS_BZIP2) // Bzip2 compression BZ2_bzclose(m_bzImageFile); + else if (m_options.dwCompression == COMPRESS_LZMA) // Lzma compression + lzmadec_close(m_lzmaImageFile); if (nRes) THROW(ERR_ERRNO, errno); @@ -1112,6 +1120,14 @@ else showDebug(1, "bzip2 open\n"); } + else if (m_options.dwCompression == COMPRESS_LZMA) // Lzma compression + { + m_lzmaImageFile = lzmadec_dopen(m_nFdImage); + if (m_lzmaImageFile == NULL) + THROW( errno); + else + showDebug(1, "lzma open\n"); + } else THROW(ERR_COMP); Only in partimage-0.6.8.new/src/client: imagefile.cpp.orig diff -ur partimage-0.6.8/src/client/imagefile.h partimage-0.6.8.new/src/client/imagefile.h --- partimage-0.6.8/src/client/imagefile.h 2009-09-12 10:06:23.000000000 +0200 +++ partimage-0.6.8.new/src/client/imagefile.h 2009-09-26 00:24:47.000000000 +0200 @@ -43,6 +43,7 @@ FILE *m_fImageFile; gzFile *m_gzImageFile; BZFILE *m_bzImageFile; + lzmadec_FILE *m_lzmaImageFile; int m_nFdImage; diff -ur partimage-0.6.8/src/client/partimage.h partimage-0.6.8.new/src/client/partimage.h --- partimage-0.6.8/src/client/partimage.h 2009-09-24 21:49:45.000000000 +0200 +++ partimage-0.6.8.new/src/client/partimage.h 2009-09-26 00:24:47.000000000 +0200 @@ -146,6 +146,7 @@ #define COMPRESS_GZIP 1 #define COMPRESS_BZIP2 2 #define COMPRESS_LZO 3 +#define COMPRESS_LZMA 4 // ENCRYPTION #define ENCRYPT_NONE 0 Only in partimage-0.6.8.new/src/client: partimage.h.orig diff -ur partimage-0.6.8/src/shared/image_disk.cpp partimage-0.6.8.new/src/shared/image_disk.cpp --- partimage-0.6.8/src/shared/image_disk.cpp 2009-09-12 10:06:22.000000000 +0200 +++ partimage-0.6.8.new/src/shared/image_disk.cpp 2009-09-26 00:24:47.000000000 +0200 @@ -328,16 +328,30 @@ checkBzip2: bzImageFile = BZ2_bzopen(szFilename, "rb"); if (bzImageFile == NULL) - goto checkNone; + goto checkLzma; dwRes = BZ2_bzread(bzImageFile, &headVolume, sizeof(CVolumeHeader)); BZ2_bzclose(bzImageFile); if (dwRes != sizeof(CVolumeHeader)) - goto checkNone; + goto checkLzma; if (strncmp(headVolume.szMagicString, szLabel, strlen(szLabel)) == 0) RETURN_int(COMPRESS_BZIP2); showDebug(3, "TRACE_003\n"); + // ------ 1.1 Check for lzma compression +checkLzma: + { // Make sure it's lzma, otherwise the decoder crashes + uint8_t b[4]; + FILE *f = fopen(szFilename, "rb"); + fread(b, 4, 1, f); + fclose(f); + if (b[0] != 0x5d || b[1] != 0x00 || b[2] != 0x00) + goto checkNone; + RETURN_int(COMPRESS_LZMA); + } + + showDebug(3, "TRACE_003\n"); + // ------ 2. Check for no compression checkNone: fImageFile = fopen(szFilename, "rb"); diff -ur partimage-0.6.8/src/shared/image_disk.h partimage-0.6.8.new/src/shared/image_disk.h --- partimage-0.6.8/src/shared/image_disk.h 2009-09-12 10:06:22.000000000 +0200 +++ partimage-0.6.8.new/src/shared/image_disk.h 2009-09-26 00:24:47.000000000 +0200 @@ -25,6 +25,7 @@ #include <zlib.h> // gzip compression #include <bzlib.h> // bzip2 compression +#include <lzmadec.h> // lzma compression #include <string.h> // ================================================