create_popufare_package.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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=1
  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. echo "# package information:"
  53. echo '# (0, "package.tgz", "'`md5sum stage/$pkgfile | cut -f1 -d' '`'", '`wc -c stage/$pkgfile | cut -f1 -d" "`', "/home/bus/package/'$pkgfile'", "'$pkgver'")'
  54. fi
  55. mv stage/$pkgfile package