Add lz and its README

This commit is contained in:
Matteo Cypriani 2010-01-03 23:35:54 +01:00
parent 7fc8da48cd
commit 1bcd00d005
2 changed files with 43 additions and 0 deletions

12
lz/README Normal file
View File

@ -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}

31
lz/lz Executable file
View File

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