# Submitted by: Amedee Van Gasse  (2009-10-16 15:25)
# 
# I would like to donate a .tar.lz driver that I have written for myself.
# It uses lzip, which uses LZMA compression. LZMA compresses better than
# bzip2, but at the expense of more memory usage.
# 
# Please test it and let me know what can be improved.


# This driver uses tar and LZMA (lzip) compression. LZMA compresses better than
# bzip2, but at the expense of more memory usage. (donated by Amedee Van Gasse)
DRIVER_MY_TAR_LZ ()
{
    case $1 in
        -test)
            require_tools tar lzip
            echo "ok"
            ;;
        -suffix)
            echo "tar.lz"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar -c -T $4 --no-recursion | lzip --best -c > $3 2>&1 \
                | grep -v 'tar: Removing leading .* from .*'
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            lzip -d $3 -c | tar t | sed 's#^#/#'
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            lzip -d $3 -c | tar -x --same-permission --same-owner -T $4 2>&1
            ;;
    esac
}

