pkg.sh 692 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # A little script to create tarball, especially for Oasis2Opam
  3. echo "Start"
  4. # If directory doesn't exist, create it
  5. if ! [ -e dist ]; then
  6. mkdir dist
  7. fi
  8. # If no tag, use commit SHA1
  9. id=`git describe --abbrev=10 --candidates=50 HEAD`
  10. name=oclaunch_${id}_src # _src emphasis the difference with binary tarballs
  11. echo "Writing in" $name".*"
  12. git archive HEAD --prefix=${name}/ --format=zip -o dist/${name}.zip -9
  13. # Creating .xz .gz and .bz2 from tar archive
  14. tar_name=${name}.tar
  15. git archive HEAD --prefix=${name}/ --format=tar -o dist/${tar_name}
  16. cd dist
  17. gzip -c9 < ${tar_name} > ${tar_name}.gz
  18. bzip2 -c9 < ${tar_name} > ${tar_name}.bz2
  19. xz -c9 < ${tar_name} > ${tar_name}.xz