12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/bin/bash
- DESTDIR=./dist
- VERSION=$(git describe --tag | sed 's/^v//')
- ITERATION=1
- BINARY=munchclient
- DEFAULTS_FILE="$BINARY"
- CONFIG_FILE="$BINARY.toml"
- SERVICE_FILE="$BINARY.service"
- PKG_TYPE=rpm
- DESCR="ScraperWall traffic collector"
- OUTDIR=./rpms-centos7
- RPM_DIR=/opt/rpm.scraperwall.com/centos7
- rm -rf $DESTDIR
- install -d $DESTDIR/{usr/bin,etc/systemd/system,etc/default,etc/munchclient,usr/share/$BINARY}
- make
- install -v -m 755 $BINARY $DESTDIR/usr/bin/
- install -v -m 644 defaults/$DEFAULTS_FILE $DESTDIR/etc/default/
- install -v -m 644 defaults/$DEFAULTS_FILE $DESTDIR/usr/share/$BINARY/$DEFAULTS_FILE.defaults
- install -v -m 644 $SERVICE_FILE $DESTDIR/etc/systemd/system
- install -v -m 644 $BINARY.toml $DESTDIR/etc/$BINARY/
- install -v -m 644 $BINARY.toml $DESTDIR/usr/share/$BINARY/
- # install -v -m 644 ca-chain.cert.pem $DESTDIR/etc/$BINARY/
- fpm -s dir -t $PKG_TYPE -C $DESTDIR --name $BINARY \
- --version $VERSION \
- --iteration $ITERATION \
- --description "$DESCR" \
- --config-files "etc/default/$BINARY" \
- --config-files "etc/$BINARY/$CONFIG_FILE" \
- --rpm-trigger-after-install "[]$BINARY: ./after-install-trigger-centos7.sh" \
- --rpm-trigger-before-uninstall "[]$BINARY: ./before-uninstall-trigger-centos7.sh" \
- -p $OUTDIR \
- --rpm-sign
- ok=$?
- rm -rf $DESTDIR
- rpm_file="$OUTDIR/$BINARY-$VERSION-$ITERATION.x86_64.rpm"
- if [ $ok -eq 0 -a -f "$rpm_file" ]; then
- # rm -f "$RPM_DIR/$BINARY-*.rpm"
- cp "$rpm_file" "$RPM_DIR"
- (cd "$RPM_DIR" && \
- createrepo -v . && \
- rsync -av --progress --delete . fender.spyz.org:/srv/http-vhosts/rpm.scraperwall.com/centos7/)
- fi
|