archive.sh 605 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # Part of Zombie Navigator
  3. # Copyright © 2015 Zombie Navigator Developers
  4. dir="`dirname "$0"`"
  5. dir="`cd "$dir"; cd .. ; pwd`"
  6. cd "$dir/src"
  7. package="`basename "$dir"`"
  8. if ! which git >/dev/null 2>&1 ; then
  9. echo "Please install git somewhere in PATH" >&2
  10. exit 1
  11. fi
  12. tree="$1"
  13. [ ! "$tree" ] && tree="`git branch | grep '*' | awk '{print $2}'`"
  14. [ ! "$tree" ] && tree="master"
  15. if ! which 7z >/dev/null 2>&1 ; then
  16. git archive --prefix="$package"_"$tree"/ "$tree" | gzip -9
  17. else
  18. git archive --prefix="$package"_"$tree"/ "$tree" | 7z a dummy -tgzip -si -so -mx=9
  19. fi
  20. # vim: ts=4 noet ai