create_popufare_package.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2019 Clementine Computing LLC.
  4. #
  5. # This file is part of PopuFare.
  6. #
  7. # PopuFare is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # PopuFare is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with PopuFare. If not, see <https://www.gnu.org/licenses/>.
  19. #
  20. VERBOSE=0
  21. mkdir -p stage
  22. mkdir -p package
  23. pkgver=`date '+%Y%m%d-%H-%M-%S'`
  24. DIUDIR=`realpath ../../busunit`
  25. SITEDIR="../../site"
  26. pkgfile="package-$pkgver.tgz"
  27. pkgdir="package-$pkgver"
  28. mkdir -p stage/$pkgdir
  29. pushd stage/$pkgdir > /dev/null
  30. if [[ "$VERBOSE" == 1 ]] ; then
  31. echo "# Creating $pkgfile in './stage/'"
  32. fi
  33. cp -R $DIUDIR/. .
  34. cp $DIUDIR/scripts/package_install.sh install.sh
  35. touch popufare.witness
  36. # copy over site specific files that overwrite default
  37. # files.
  38. #
  39. if [[ -d "$SITEDIR" ]] ; then
  40. cp -L -R ../../site .
  41. else
  42. echo "# warning: no site specific directory found ($SITEDIR)"
  43. fi
  44. tar -czf ../$pkgfile *
  45. popd > /dev/null
  46. rm -rf stage/$pkgdir
  47. if [[ "$VERBOSE" == 1 ]] ; then
  48. echo "# done"
  49. fi
  50. if [[ "$VERBOSE" == 1 ]] ; then
  51. echo "# putting package '$pkgfile' in ./package"
  52. fi
  53. mv stage/$pkgfile package