utils.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. do_install() {
  3. local GTKDIR GTK320DIR GTKVER INSTALL_DIR
  4. INSTALL_DIR="$1"
  5. GTKDIR="${INSTALL_DIR}/gtk-3.0"
  6. GTK320DIR="${INSTALL_DIR}/gtk-3.20"
  7. install -dm755 "${INSTALL_DIR}"
  8. cd src
  9. cp index.theme "${INSTALL_DIR}"
  10. cp -rt "${INSTALL_DIR}" \
  11. assets gtk-2.0 metacity-1 openbox-3 xfwm4 unity
  12. for _DIR in "${GTKDIR}" "${GTK320DIR}"
  13. do
  14. GTKVER="${_DIR##*/}"
  15. mkdir -p "${_DIR}"
  16. cp -t "${_DIR}" \
  17. "${GTKVER}/gtk.css" \
  18. "${GTKVER}/gtk-dark.css" \
  19. "${GTKVER}/gtk.gresource" \
  20. "${GTKVER}/thumbnail.png"
  21. cd "${_DIR}"
  22. ln -srf ../assets assets
  23. cd -
  24. done
  25. }
  26. output_changes_file_version_marker() {
  27. line() {
  28. dashes="$(printf '%0.s-' $(seq 1 13))"
  29. echo "${dashes}>>>> $1 <<<<${dashes}"
  30. }
  31. tag_line="$(line $1)"
  32. echo "-${tag_line}${tag_line}${tag_line}-"
  33. }
  34. update_changes_file() {
  35. LAST_STABLE_RELEASE=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1))
  36. LAST_MAJOR_MINOR="${LAST_STABLE_RELEASE%.*}"
  37. LAST_MAJOR="${LAST_STABLE_RELEASE%%.*}"
  38. LAST_MINOR="${LAST_MAJOR_MINOR#*.}"
  39. LAST_PATCH="${LAST_STABLE_RELEASE##*.}"
  40. case "${PWD##*/}" in
  41. numix-gtk-theme)
  42. NEXT_PATCH=$(($LAST_PATCH + 1))
  43. NEXT_STABLE_RELEASE="${LAST_MAJOR_MINOR}.${NEXT_PATCH}"
  44. ;;
  45. Librix-Frost)
  46. LAST_MAJOR=$(($LAST_MAJOR + 1))
  47. NEXT_STABLE_RELEASE="${LAST_MAJOR}.${LAST_MINOR}.${LAST_PATCH}"
  48. LAST_PATCH=$(($LAST_PATCH - 1))
  49. LAST_STABLE_RELEASE="${LAST_MAJOR}.${LAST_MINOR}.${LAST_PATCH}"
  50. ;;
  51. *)
  52. echo 'Unknown directory!' && exit 1
  53. ;;
  54. esac
  55. [[ -f CHANGES ]] && mv CHANGES CHANGES.old
  56. output_changes_file_version_marker "${NEXT_STABLE_RELEASE}" > CHANGES
  57. { git log \
  58. --pretty=format:"[%ai] %<(69,trunc) %s %><(15) %aN {%h}" \
  59. --cherry-pick "${LAST_STABLE_RELEASE}...HEAD"; } >> CHANGES
  60. [[ -f CHANGES.old ]] && echo "" >> CHANGES && cat CHANGES.old >> CHANGES && rm CHANGES.old
  61. git add CHANGES
  62. git commit -m 'RELEASE PREP :: Update CHANGES file.'
  63. git push
  64. }
  65. case $1 in
  66. changes)
  67. update_changes_file
  68. exit $?
  69. ;;
  70. install)
  71. do_install "$2"
  72. ;;
  73. *)
  74. exit 0
  75. ;;
  76. esac