build-archives.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # ////////////////////////////////////////////////////////////////////
  3. #
  4. # build-archives.sh
  5. # A shell script that packages .zip, tar.gz, and tar.xz font archives
  6. # Copyright 2018 Christopher Simpkins
  7. # MIT License
  8. #
  9. # Usage: ./build-archives.sh
  10. #
  11. # ////////////////////////////////////////////////////////////////////
  12. HACK_VERSION="v4.000"
  13. HACK_ARCHIVES_DIR="../../Hack-archives"
  14. HACK_BUILD_DIR="build"
  15. # Make build directory the current working directory
  16. cd "$HACK_BUILD_DIR" || exit 1
  17. # Cleanup Hack-archives directory if present
  18. if [ -d "$HACK_ARCHIVES_DIR" ]; then
  19. rm -rf "$HACK_ARCHIVES_DIR"
  20. fi
  21. # Make the archive directory
  22. mkdir "$HACK_ARCHIVES_DIR"
  23. # Build ttf zip archive
  24. zip -r "${HACK_ARCHIVES_DIR}/Hack-${HACK_VERSION}-ttf.zip" ttf -x "*.DS_Store"
  25. # Build web font zip archive
  26. zip -r "${HACK_ARCHIVES_DIR}/Hack-${HACK_VERSION}-webfonts.zip" web -x "*.DS_Store"
  27. # Build ttf tar.gz archive
  28. tar -c --exclude=".DS_Store" --exclude="./.DS_Store" --exclude="./*/.DS_Store" -vzf "${HACK_ARCHIVES_DIR}/Hack-${HACK_VERSION}-ttf.tar.gz" ttf
  29. # Build web font tar.gz archive
  30. tar -c --exclude=".DS_Store" --exclude="./.DS_Store" --exclude="./*/.DS_Store" -vzf "${HACK_ARCHIVES_DIR}/Hack-${HACK_VERSION}-webfonts.tar.gz" web
  31. # Build ttf tar.xz archive
  32. tar -c --exclude=".DS_Store" --exclude="./.DS_Store" --exclude="./*/.DS_Store" -C ttf . | xz --extreme -9 --force > "${HACK_ARCHIVES_DIR}/Hack-${HACK_VERSION}-ttf.tar.xz"
  33. # Build web font tar.xz archive
  34. tar -c --exclude=".DS_Store" --exclude="./.DS_Store" --exclude="./*/.DS_Store" -C web . | xz --extreme -9 --force > "${HACK_ARCHIVES_DIR}/Hack-${HACK_VERSION}-webfonts.tar.xz"