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 "$@"