build-rpm-centos7.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. DESTDIR=./dist
  3. VERSION=$(git describe --tag | sed 's/^v//')
  4. ITERATION=1
  5. NAME=scw-apache-lua
  6. #BINARY=$NAME
  7. #DEFAULTS_FILE="$BINARY"
  8. #CONFIG_FILE="$NAME.toml"
  9. SERVICE_FILE="$NAME.conf"
  10. SERVICE_DIR="/etc/systemd/system/httpd.service.d"
  11. PKG_TYPE=rpm
  12. DESCR="ScraperWall Integration of Blacklist, Captcha and Apache"
  13. OUTDIR=./rpms-centos7
  14. RPM_DIR=/opt/rpm.scraperwall.com/centos7
  15. rm -rf $DESTDIR
  16. install -d $DESTDIR/usr/local/httpd
  17. install -d $DESTDIR/etc/default
  18. install -d $DESTDIR/etc/httpd/conf.d
  19. install -d ${DESTDIR}${SERVICE_DIR}
  20. install -v -m 644 scw-apache-lua.conf ${DESTDIR}${SERVICE_DIR}/${SERVICE_FILE}
  21. install -v -m 644 centos7-httpd-lua.conf $DESTDIR/etc/httpd/conf.d/scw-apache-lua.conf
  22. cp -rv lua $DESTDIR/usr/local/httpd
  23. install -v -m 644 default $DESTDIR/etc/default/$NAME
  24. fpm -s dir -t $PKG_TYPE -C $DESTDIR --name $NAME \
  25. --version $VERSION \
  26. --iteration $ITERATION \
  27. --description "$DESCR" \
  28. --config-files "etc/default/$NAME" \
  29. -p $OUTDIR \
  30. --rpm-sign
  31. # --rpm-trigger-after-install "[]$BINARY: ./centos7-install.sh" \
  32. # --rpm-trigger-before-uninstall "[]$BINARY: ./centos7-uninstall.sh" \
  33. ok=$?
  34. rm -rf $DESTDIR
  35. rpm_file="$OUTDIR/$NAME-$VERSION-$ITERATION.x86_64.rpm"
  36. if [ $ok -eq 0 -a -f "$rpm_file" ]; then
  37. # rm -f "$RPM_DIR/$BINARY-*.rpm"
  38. cp "$rpm_file" "$RPM_DIR"
  39. (cd "$RPM_DIR" && \
  40. createrepo -v . && \
  41. rsync -av --progress --delete . fender.spyz.org:/srv/http-vhosts/rpm.scraperwall.com/centos7/)
  42. fi