scripts/archivers
Matteo Cypriani d321ec9761 [archivers] xzize: output file to same directory
Fix bug that caused the output file to always be generated in the
current working directory.
2019-10-28 16:20:50 +01:00
..
README.md [archivers] xzize: improve doc 2019-10-28 16:20:12 +01:00
TODO Rename compression_utils -> archivers 2017-09-22 16:50:25 -04:00
lz.sh [archivers] shellcheck 2018-04-11 21:30:19 +02:00
xzize.sh [archivers] xzize: output file to same directory 2019-10-28 16:20:50 +01:00

README.md

lz.sh (lz and uz)

The lz.sh script emulates and extends commands lz and uz from the mtools.

Note: although lz.sh is more powerful than mtools' lz and uz, you should probably use als and aunpack from the atool package instead; they are much better and atool provides several other useful commands as well. This script is still useful when you can't install Perl (atool is written in Perl).

This script handles the following archive formats through the standards options of GNU Tar:

  • tar
  • tar.gz (tgz)
  • tar.bz2 (tbz, tb2)
  • tar.xz (txz)
  • tar.lzma (tlz)
  • tar.Z (taz)

Note that you need GNU Tar, at least version 1.20 to support LZMA compressed archives, and version 1.22 for XZ compressed ones.

If the script is called as lz, the archive content is displayed. When called as uz, it is extracted.

To install lz and uz, move the script as lz in a directory in your PATH (for instance /usr/local/bin or $HOME/bin) and hard link it to uz:

cp lz.sh /usr/local/bin/lz
ln /usr/local/bin/{lz,uz}

Alternatively, you can use the symbolic links provided along with the repository by adding the bin directory to your PATH, as explained in the main README.md file.

xzize.sh

The xzize.sh script compresses an uncompressed file, or recompresses a compressed file to XZ (with default compression level).

Known compression formats are GZip (.gz), BZip2 (.bz2), LZMA (.lzma), and Lempel-Ziv (.Z). Short tar compressed suffixes are also allowed: .tgz, .tbz, .tb2, .tlz, .taz (and the output file's extension will be .txz).

In case of recompression, the original compressed file is kept (so you can compare input and output file sizes and decide to keep the original or the recompressed file). In case of compression (i.e. when the suffix of the file does not correspond to a known compression format), the original uncompressed file is removed.

Note: the atool package provides the arepack command, which can recompress to several formats and not only to XZ. xzize has the advantage to recompress on the fly rather than unpacking the archive entirely on the file system and repacking it afterwards.