aboutsummaryrefslogtreecommitdiffstats
path: root/build-aux/travis-deploy.sh
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-03-08 20:33:21 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-03-08 20:33:21 +0100
commit214d09891909ce5505d7bdbc5c848a9c4be23c0d (patch)
tree143098c6b3529debd326d6cee04d1bd18556a456 /build-aux/travis-deploy.sh
parentd8f0fc6cb36a9d7c153a974b5095a4efb8c8add0 (diff)
downloadblogc-214d09891909ce5505d7bdbc5c848a9c4be23c0d.tar.gz
blogc-214d09891909ce5505d7bdbc5c848a9c4be23c0d.tar.bz2
blogc-214d09891909ce5505d7bdbc5c848a9c4be23c0d.zip
travis: added script to upload distfiles
Diffstat (limited to 'build-aux/travis-deploy.sh')
-rwxr-xr-xbuild-aux/travis-deploy.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/build-aux/travis-deploy.sh b/build-aux/travis-deploy.sh
new file mode 100755
index 0000000..267c8d5
--- /dev/null
+++ b/build-aux/travis-deploy.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+set -e
+
+if [[ "x${TARGET}" != xw* ]] && [[ "x${TARGET}" != xdist* ]]; then
+ echo "Nothing to deploy."
+ exit 0
+fi
+
+if [[ ! -d build ]]; then
+ echo "Build directory not found."
+ exit 1
+fi
+
+if [[ "x${TARGET}" = xw* ]]; then
+ FILES=( build/*.zip )
+elif [[ "x${TARGET}" = "xdist-srpm" ]]; then
+ FILES=( build/*.src.rpm )
+else
+ FILES=( build/*.{*.tar.{gz,bz2,xz},zip} )
+fi
+
+TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)"
+VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)"
+
+do_curl() {
+ curl \
+ --silent \
+ --ftp-create-dirs \
+ --upload-file "${1}" \
+ --user "${FTP_USER}:${FTP_PASSWORD}" \
+ "ftp://${FTP_HOST}/public_html/${TARNAME}/${TARNAME}-${VERSION}/$(basename ${1})"
+}
+
+echo " * Found files:"
+for f in "${FILES[@]}"; do
+ echo " $(basename ${f})"
+done
+echo
+
+for f in "${FILES[@]}"; do
+ echo " * Processing file: $(basename ${f}):"
+
+ echo -n " Generating SHA512 checksum ... "
+ pushd build > /dev/null
+ sha512sum "$(basename ${f})" > "$(basename ${f}).sha512"
+ popd > /dev/null
+ echo "done"
+
+ echo -n " Uploading file ... "
+ do_curl "${f}"
+ echo "done"
+
+ echo -n " Uploading SHA512 checksum ... "
+ do_curl "${f}.sha512"
+ echo "done"
+
+ echo
+done