aboutsummaryrefslogtreecommitdiffstats
path: root/build-aux/travis-deploy.sh
diff options
context:
space:
mode:
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