From 1bcd00d0057a629ef2267d800f9e065c4fd65c25 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Sun, 3 Jan 2010 23:35:54 +0100 Subject: [PATCH] Add lz and its README --- lz/README | 12 ++++++++++++ lz/lz | 31 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 lz/README create mode 100755 lz/lz diff --git a/lz/README b/lz/README new file mode 100644 index 0000000..76f6ae8 --- /dev/null +++ b/lz/README @@ -0,0 +1,12 @@ +The lz script emulates and extends the lz and uz commands of the mtools. + +It handles: .tar, .tar.gz, .tar.bz2, .tar.xz and .tar.lzma, through the +standards options of GNU tar. + +If the script name is "lz", the archive content is displayed. If the name +is "uz", it is extracted. + +To install lz and uz, move put script in a directory in the PATH (for +instance /usr/local/bin) and hard link it to uz: + cp lz /usr/local/bin + ln /usr/local/bin/{lz,uz} diff --git a/lz/lz b/lz/lz new file mode 100755 index 0000000..72dfcff --- /dev/null +++ b/lz/lz @@ -0,0 +1,31 @@ +#!/bin/sh +# This script emulates and extends the lz and uz commands of the mtools. +# It handles: .tar, .tar.gz, .tar.bz2, .tar.xz and .tar.lzma, through the +# standards options of GNU tar. +# If the script name is "lz", the archive content is displayed. If the name +# is "uz", it is extracted. + +PROGRAM=`basename $0` + +if [ "$PROGRAM" = "lz" ] ; then + ACTION="t" +elif [ "$PROGRAM" = "uz" ] ; then + ACTION="x" +else + echo '$0 = "'"$0"' (not "lz" nor "uz")!' + exit 1 +fi + +if [ `basename "$1" .tar` != "$1" ] ; then + FORMAT="" +elif [ `basename "$1" .tar.gz` != "$1" ] ; then + FORMAT="--gzip" +elif [ `basename "$1" .tar.bz2` != "$1" ] ; then + FORMAT="--bzip" +elif [ `basename "$1" .tar.xz` != "$1" ] ; then + FORMAT="--xz" +elif [ `basename "$1" .tar.lzma` != "$1" ] ; then + FORMAT="--lzma" +fi + +tar "$FORMAT" -"$ACTION"f "$@"