UnTGZ plug-in: Difference between revisions
PerditionC (talk | contribs) m (→Description: found v1.0.13 so correct version info) |
PerditionC (talk | contribs) (→Notes: add info about latest version) |
||
Line 87: | Line 87: | ||
Version 1.0.12 finally implements -k keep option, also adds -u update option (same as keep, but will overwrite a file if older than one in archive), and now aborts extraction with error when it fails to extract a file (such as file readonly or open -- previously is just silently skipped the file and returned success). | Version 1.0.12 finally implements -k keep option, also adds -u update option (same as keep, but will overwrite a file if older than one in archive), and now aborts extraction with error when it fails to extract a file (such as file readonly or open -- previously is just silently skipped the file and returned success). | ||
Version 1.0.13 integrated BZip2 (v1.0.3) support using miniclib (this version now supports none, gzip, bzip2, or lzma compressed TAR files). Updated to lzma sdk 4.43. | |||
[[Category:Plugins]] | [[Category:Plugins]] |
Revision as of 19:31, 3 November 2007
Author: PerditionC (talk, contrib) |
Links
Download:
Untgz.zip (259 KB)
Untgz.1.0.13.zip (232 KB) (Mirror #1)
Untbgz.zip (249 KB) Older Untgz plugin with bz2 support, requires MSVCRT.DLL
Untgz.1.0.10.zip (158 KB) Older Untgz plugin with only gzip & LZMA support
Older releases may be found at http://www.fdos.org/win32/nsis/plugins/.
Description
Version: 1.0.13
UnTGZ plugin is similar to ExtractDLL and ZipDLL plugins, except it allows one to extract the files from a tarball. Only simple tarballs are supported, those with filenames longer than 100 characters or including special files may not be supported well (please send me information including where to obtain a sample tarball if better support is required for one of these).
Supports TAR files with no compression (*.tar), gzipped [zlib compatible] compression (*.tgz / *.tar.gz), lzma compression (*.tlz / *.tar.lzma), and bzip2 compression (*.tbz / *.tar.bz2).
For problems, corrections, etc. send email to PerditionC __at gmail.com (or jeremyd --at-- fdos.org)
Usage
- untgz::extract [-j] [-d basedir] [-k] [-z<type>] tarball.tgz
- extracts all files from tarball.tgz
- if -j is specified then ignore paths in tarball (junkpaths)
- if -d is specified will extract relative to basedir
- if -k is specified will not overwrite existing files (keep)
- if -u is specified will only overwrite nonexisting or older files (update), INPROGRESS
- if -z is specified determines compression used, see below
- untgz::extractV [-j] [-d basedir] [-k] [-z<type>] tarball.tgz [-i {iList}] [-x {xList}] --
- extracts files from tarball.tgz
- if -j is specified then ignore paths in tarball (junkpaths)
- if -d is specified will extract relative to basedir
- if -k is specified will not overwrite existing files (keep)
- if -u is specified will only overwrite nonexisting or older files (update), INPROGRESS
- if -z is specified determines compression used, see below
- if -i is specified will only extract files whose filename matches
- if -x is specified will NOT extract files whose filename matches
- the -- is required and marks the end of the file lists
- untgz::extractFile [-d basedir] [-z<type>] tarball.tgz file
- extracts just the file specified
- path information is ignored, implictly -j is specified (may also be explicit)
- For compatibility with tar command, the following option specifiers may be used prior to tar file name (tarball.tgz), however, they are simply ignored.
- -x indicates action to perform is extraction (extract)
- -f archive-name indicates name of tarball (filename), note even when used, the filename must be last argument
- If the tarball uses a compression other than gz, then the -z<type> option must be specified to indicate how tar file is compressed.
- -z indicates gzip (.tgz/.tar.gz) compression, uses zlib, this is the default if -z<type> option is omitted
- -znone indicates uncompressed tar file (.tar), may be omitted (internally same as -z)
- -zlzma indicates lzma (.tlz/.tar.lzma) compression
- -zbz2 indicates bzip2 (.tbz/.tar.bz2) compression
- NOTES
Without -j there is a security issue as no checking is done to paths, allowing untrusted tarballs to overwrite arbitrary files (e.g. /bin/*). Also no checking is done to directory or file names. In untar.c there is a hook so custom versions can modify/strip filepaths prior to opening. The -d option is currently implemented by a chdir to indicatd directory prior to extraction; future versions may instead prepend to extracted path.
Example usage
This is a snippet from AbiWord's NSIS2 script:
doDictInst: ; Unzip dictionary into dictionary subdirectory untgz::extract "-j" "-d" "$INSTDIR\dictionary" "$TEMP\${DICT_FILENAME}" ; Delete temporary files Delete "$TEMP\${DICT_FILENAME}" Finish:
Notes
Currently tested with NSIS 2.0x
Based on ExDLL/ExDLL.h and Zlib's untgz, all dependencies included, simply extract to your contrib directory and build with MSVC 6 (or later) or copy included untgz.dll to the plugins subdirectory of your NSIS installation. Some parts (such as extraction with paths) not as well tested. See included README.TXT for more details.
Note: 1.0.9 version fixes problems extracting files from some valid tarballs (updated zlib), which while tested, some issues may still exist that I haven't seen; please test (see also Plugin Tester) your tarballs with it and report to me should any problems occur. Thanks.
As of version 1.0.10, untgz plugin supports lzma compressed TAR files (adds about 5KB to plugin size, so can optionally be compiled out). Create a normal uncompressed tar file (*.tar), then instead of gzipping (or bzipping/compress'ing) use lzma from LZMA SDK (http://www.7zip.org/sdk.html). E.g. 'lzma e myarchive.tar myarchive.tlz'
Version 1.0.11 adds support for compiling with MSVC 8 (Express 2005 + SDK). Unless you wish to recompile with VC8 there no need to update from 1.0.10
Version 1.0.12 finally implements -k keep option, also adds -u update option (same as keep, but will overwrite a file if older than one in archive), and now aborts extraction with error when it fails to extract a file (such as file readonly or open -- previously is just silently skipped the file and returned success).
Version 1.0.13 integrated BZip2 (v1.0.3) support using miniclib (this version now supports none, gzip, bzip2, or lzma compressed TAR files). Updated to lzma sdk 4.43.