A terminal client for the Mattermost chat system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mkrelease.sh 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env bash
  2. set -e
  3. HERE=$(cd `dirname $0`; pwd)
  4. function get_platform {
  5. if [ -f "/etc/redhat-release" ]
  6. then
  7. if grep Fedora /etc/redhat-release >/dev/null
  8. then
  9. echo "Fedora"
  10. else
  11. echo "Unknown-Redhat"
  12. fi
  13. elif grep -i ubuntu /etc/apt/sources.list 2>/dev/null >/dev/null
  14. then
  15. echo "Ubuntu"
  16. else
  17. uname -s
  18. fi
  19. }
  20. function get_arch {
  21. uname -m
  22. }
  23. VERSION=$(grep "^version:" matterhorn.cabal | awk '{ print $2 }')
  24. BASENAME=matterhorn
  25. ARCH=$(get_arch)
  26. PLATFORM=$(get_platform)
  27. LONG_HEAD=$(git log | head -1 | awk '{ print $2 }')
  28. SHORT_HEAD=${LONG_HEAD:0:8}
  29. DIRNAME=$BASENAME-$VERSION-$PLATFORM-$ARCH
  30. FILENAME=$DIRNAME.tar.bz2
  31. CABAL_DEPS_REPO=https://github.com/matterhorn-chat/cabal-dependency-licenses.git
  32. CABAL_DEPS_TOOL_DIR=$HOME/.cabal/bin
  33. function prepare_dist {
  34. local dest=$1
  35. cp $HERE/dist-newstyle/build/matterhorn-$VERSION/build/matterhorn/matterhorn $dest
  36. strip $dest/matterhorn
  37. cp $HERE/sample-config.ini $dest
  38. cp $HERE/README.md $dest
  39. cp $HERE/CHANGELOG.md $dest
  40. echo $LONG_HEAD > $dest/COMMIT
  41. cd $HERE && $CABAL_DEPS_TOOL_DIR/cabal-dependency-licenses > $dest/COPYRIGHT
  42. }
  43. function install_tools {
  44. if [ ! -f $CABAL_DEPS_TOOL_DIR/cabal-dependency-licenses ]
  45. then
  46. BUILD=$(mktemp -d)
  47. cd $BUILD
  48. git clone $CABAL_DEPS_REPO
  49. cd cabal-dependency-licenses
  50. cabal install
  51. mkdir -p $CABAL_DEPS_TOOL_DIR
  52. cd $HERE && rm -rf $BUILD
  53. fi
  54. }
  55. install_tools
  56. echo Version: $VERSION
  57. echo Filename: $FILENAME
  58. cd $HERE && ./install.sh
  59. TMPDIR=$(mktemp -d)
  60. function cleanup {
  61. rm -rf $TMPDIR
  62. }
  63. trap cleanup EXIT
  64. mkdir $TMPDIR/$DIRNAME
  65. prepare_dist $TMPDIR/$DIRNAME
  66. cd $TMPDIR && tar -cj $DIRNAME > $HERE/$FILENAME