build-rpm.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. DESTDIR=./dist
  3. VERSION=`git describe --tag | sed 's/^v//'`
  4. ITERATION=1
  5. BINARY=munchclient
  6. DEFAULTS_FILE="$BINARY"
  7. SERVICE_FILE="$BINARY.service"
  8. PKG_TYPE=rpm
  9. DESCR="ScraperWall traffic collector"
  10. RPM_DIR=/opt/rpm.scraperwall.com/centos6
  11. rm -rf $DESTDIR
  12. install -v -d $DESTDIR/{usr/bin,etc/init.d,etc/default}
  13. make
  14. install -v -m 755 $BINARY $DESTDIR/usr/bin/
  15. install -v -m 644 defaults/$DEFAULTS_FILE $DESTDIR/etc/default/
  16. #install -v -m 755 init.d/$BINARY $DESTDIR/etc/init.d/
  17. #install -m 644 $SERVICE_FILE $DESTDIR/etc/systemd/system/
  18. #install -m 644 $MAXMIND_CITY_DB $DESTDIR/usr/share/munch/
  19. #install -m 644 $MAXMIND_ASN_DB $DESTDIR/usr/share/munch/
  20. fpm -s dir -t $PKG_TYPE -C $DESTDIR --name $BINARY \
  21. --version $VERSION \
  22. --iteration $ITERATION \
  23. --description "$DESCR" \
  24. --config-files etc/default/$BINARY \
  25. --rpm-init init.d/$BINARY \
  26. --rpm-sign
  27. # --deb-systemd $SERVICE_FILE \
  28. ok=$?
  29. rm -rf $DESTDIR
  30. exit
  31. rpm_file="munch-$VERSION-$ITERATION.x86_64.rpm"
  32. if [ $ok -eq 0 -a -f "$rpm_file" ]; then
  33. rm -f "$RPM_DIR/munch-*.rpm"
  34. cp "$rpm_file" "$RPM_DIR"
  35. (cd "$RPM_DIR" && \
  36. createrepo -v . && \
  37. rsync -av --progress --delete . fender.spyz.org:/srv/http-vhosts/rpm.scraperwall.com/)
  38. fi