diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-17 12:07:33 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-17 12:14:22 +0200 |
commit | 97b6c47b21f5d2bfb7a43969f67d6b3ad6edab28 (patch) | |
tree | 6a01342ce3dc1996f1cdf965ad3a189a44d35e63 | |
parent | 507ad23581797779f182adc116aae5556d2d2d78 (diff) |
cmake: upload tarball to Dropbox but only if I'm the user
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | make-tar.sh | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 197bad8b..482bdb6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,7 +216,9 @@ set(filename_0 "${OPENTRACK_COMMIT}") string(TIMESTAMP filename_1 "%Y%m%d%H%M%S") set(filename "${CMAKE_BINARY_DIR}/${filename_0}-${filename_1}.zip") -add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") +add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh + "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" + "${filename}" "${CMAKE_BINARY_DIR}") add_custom_target(tarball DEPENDS "${filename}") opentrack_module(opentrack-api opentrack) diff --git a/make-tar.sh b/make-tar.sh index 8954a4ba..e831f16a 100644 --- a/make-tar.sh +++ b/make-tar.sh @@ -2,16 +2,23 @@ prefix="$1" filename="$2" +bin="$3" -rm -fv "$filename" +cmake --build "$bin" --target install || exit 1 if : && cd $(dirname -- "${prefix}") && zip -9r "${filename}" $(basename "${prefix}") then - ls -lh -- "${filename}" - case "$(uname -s)" in - CYGWIN_*) ls -lh -- "$(cygpath -w -- "$filename")";; + case "$USER,$(uname -s)" in + # for the script see https://github.com/andreafabrizi/Dropbox-Uploader + sthalik,CYGWIN_*) + dropbox_uploader.sh -p upload "$filename" / && + l="$(dropbox_uploader.sh share "/$filename")" && + f="$(echo "$l" | tr -d '\n\r' | egrep -o 'https://[^ ]+$')" && + test -n "$f" && { echo "$f"; echo -n "$f" | putclip; } + echo -ne '\a' ;; + *) ls -lh -- "${filename}" ;; esac else rm -fv -- "${filename}" |