Skip to content

vaeth/archwrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 

Repository files navigation

archwrap

A collection of POSIX shell scripts to invoke archiver programs

(s)tar/gzip/bzip2/bzip3/xz/zip/7z/lzma/lrzip/arj/zoo/brotli/zopfli/zstd

Author: Martin Väth

This project is under the BSD license 2.0 (“3-clause BSD license”). SPDX-License-Identifier: BSD-3-Clause

These are some POSIX shell scripts which form an interface to various archiver programs like

  • tar/star
  • brotli
  • zstd
  • gzip/zopfli
  • bzip2
  • bzip3
  • xz/lzma
  • zip
  • 7z
  • lrzip
  • arj
  • zoo

For unpacking even some more formats are supported (if binaries are available).

It is in particular possible to invoke all archivers (keeping only the "best" result), to repack archives, pack to remote hosts etc. Note that also less popular archivers are supported.

A lot of options control the details; since the scripts are mainly written for myself, they are not too well documented. Use option -h to obtain help.

Requirements

You need push.sh from https://github.com/vaeth/push (v2.0 or newer) in your $PATH.

Installation

For installation. just put the content of bin somewhere in your $PATH. Also put the files of the subdirectory zsh into your zsh's $fpath to obtain zsh completion support. (If you do not have root access, you can add the corresponding directory with fpath+=("...") before you call compdef from your zsh initialization files).

If you do have root access it is recommended to put the files archwrap.sh not into the $PATH (typically /usr/bin) but instead into /usr/share/archwrap/ and to modify the line

. archwrap.sh

in the binaries into

. /usr/share/archwrap/archwrap.sh

If you do not want to put the symlinks into your path, you can source the archwrap_alias file (in a shell understanding the alias command) to obtain a similar effect in an interactive shell.

For installation under Gentoo, there is an ebuild in the mv repository (available by app-select/eselect-repository or app-portage/layman).

Examples

A standard usage is as follows

    • ppd directory(s) / pd directory(s)

      Pack directory(s) with all subdirectories with all archiver programs (each directory is put into a separate archive) and keep only the "best" version. Lots of options control the details: Invoke pd/ppd without any arguments for a list of them. ppd (in contrast to pd) only attempts the most popular archivers.

    • tgzd directory(s) (actually uses zopfli unless -Q is specified)

    • tbrd directory(s)

    • tbzd directory(s)

    • tlzd directory(s)

    • t7zd directory(s)

    • tlrd directory(s)

    • txzd directory(s)

    • tzsd directory(s)

    • tard directory(s)

    • zipd directory(s)

    • gzipd directory(s) (uses .tar.gz extension)

    • brd directory(s) (uses .tar.br extension)

    • bzipd directory(s) (uses .tar.bz2 extension)

    • lzmad directory(s) (uses .tar.lzma extension)

    • zstdd directory(s) (uses .tar.zst extension)

    • xzd directory(s) (uses .tar.xz extension)

    • 7zd directory(s) (uses .tar.7z extension)

    • lrzd directory(s) (uses .tar.lrz extension)

      Similarly as ppd but invokes only the corresponding archiver program. Different options are available, depending on the archiver program.

    • ud ARCHIVE(s) Generate the directory(s) ARCHIVE and unpack ARCHIVE.??? into it. This works for all archive formats (with proper name extension). Invoke ud without any arguments for a complete list of options.

    • uv ARCHIVE(s) or uv -v ARCHIVE(s)

      List content of ARCHIVE(s) (briefly or verbosely, respectively). This works for all supported archive formats whose archivers have corresponding options.

    • u -t ARCHIVE(s)

      Test integrity of ARCHIVE(s). This works for all supported archive formats whose archivers have corresponding options.

  1. 2pd ARCHIVE(s) or 2ppd ARCHIVE(s) First unpack ARCHIVE and then pack it again with all/popular archivers, keeping only the "best" version. Invoke 2pd without any arguments for a complete list of options.

  2. tbzd -C -R - / | sshcat user@host:backup.tar.bz2

    Make a compressed backup of the whole filesystem to a file on a remote host.