Skip to content

Instantly share code, notes, and snippets.

@mtigas
Created January 4, 2011 02:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mtigas/764291 to your computer and use it in GitHub Desktop.
Save mtigas/764291 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Wraps the standard tar command with the xz (LZMA2)
# compression program since Mac OS X's old version of `tar`
# doesn't have the -I shortcut flag.
#
# Requires XZ Utils.
#
# On Mac OS X with homebrew, you can get XZ Utils via:
# brew install xz
/usr/bin/tar --use-compress-program=xz_wrap.sh $@
# ALTERNATIVE:
# If you don't care about customizing the compression
# level & RAM use, you can just call xz with the defaults
# and skip the wrapper script below.
#
# /usr/bin/tar --use-compress-program=xz $@
#!/bin/bash
# xz wrapper script for compatibility with tar.
#
# Wraps a data stream through xz (LZMA2) compression or
# decompression (if the -d flag is set) with some customizations.
#
# Feel free to adjust the xz settings (currently uses -3)
# depending on the system this script is deployed on.
case $1 in
-d) xz -qdvc ;;
'') xz -qzvc -3 ;;
*) echo "Unknown option $1">&2; exit 1;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment