diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c848e6cd38c7aab18e2388e84e5c4f263f24a7d3..44b130818863f1904abb60c223c5388e3abed7cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,10 +74,10 @@ pep8: - unprivileged needs: [install] script: - - s3/download-from-s3.sh "${PREF}" "${S3_KEY}" "${S3_SECRET}" "${S3_HOST}" "${S3_BUCKET}" || true + - s3/download-from-s3.sh "${PREF}" "${S3_KEY}" "${S3_SECRET}" "${S3_HOST}" "${S3_BUCKET}" data/ || true - /etc/init.d/tor start - make "${PREF}" - - s3/upload-to-s3.sh "${PREF}" "${S3_KEY}" "${S3_SECRET}" "${S3_HOST}" "${S3_BUCKET}" || true + - s3/upload-to-s3.sh "${PREF}" "${S3_KEY}" "${S3_SECRET}" "${S3_HOST}" "${S3_BUCKET}" data/ || true cache: key: $CI_COMMIT_REF_SLUG paths: diff --git a/s3/download-all-from-s3.sh b/s3/download-all-from-s3.sh index be63608010ae96ec7cdc72e7e7a9ba5d489278f2..23e1f774fc3b582386ada28a9307755a14cddb0e 100755 --- a/s3/download-all-from-s3.sh +++ b/s3/download-all-from-s3.sh @@ -6,6 +6,7 @@ s3_key="${1}" s3_secret="${2}" s3_host="${3}" s3_bucket="${4}" +dest="${5}" root_path=$(dirname $(realpath "${BASH_SOURCE[0]}")) @@ -111,12 +112,12 @@ pref973 pref974 pref976" -if test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket"; then - echo "Usage: ${0} <s3_key> <s3_secret> <s3_host> <s3_bucket>" +if test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket" || test -z "$dest"; then + echo "Usage: ${0} <s3_key> <s3_secret> <s3_host> <s3_bucket> <dest>" exit 1 fi for i in $administrations; do - ${root_path}/download-from-s3.sh "${i}" "$s3_key" "$s3_secret" "$s3_host" "$s3_bucket" || true - rm "${root_path}/../data/${i}.zip" || true + ${root_path}/download-from-s3.sh "${i}" "$s3_key" "$s3_secret" "$s3_host" "$s3_bucket" "$dest" || true + rm "${dest}/${i}.zip" || true done diff --git a/s3/download-from-s3.sh b/s3/download-from-s3.sh index 1a36d5585cb01acf79e31cefce1e658baabab664..239823d3a8e61df3ec24f3efc3f21bc2e5e2aa00 100755 --- a/s3/download-from-s3.sh +++ b/s3/download-from-s3.sh @@ -7,14 +7,17 @@ s3_key="${2}" s3_secret="${3}" s3_host="${4}" s3_bucket="${5}" +dest="${6}" -if test -z "$pref" || test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket"; then - echo "Usage: ${0} <pref> <s3_key> <s3_secret> <s3_host> <s3_bucket>" +if test -z "$pref" || test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket" || test -z "$dest"; then + echo "Usage: ${0} <pref> <s3_key> <s3_secret> <s3_host> <s3_bucket> <dest>" exit 1 fi -mkdir -p "$(dirname $(realpath "${BASH_SOURCE[0]}"))/../data/" -cd "$(dirname $(realpath "${BASH_SOURCE[0]}"))/../data/" +dest=$(realpath "${dest}") + +mkdir -p "${dest}/" +cd "${dest}/" file="${pref}.zip" diff --git a/s3/upload-all-to-s3.sh b/s3/upload-all-to-s3.sh index 8062253e0052ddbc5be925c8043cb240ebcfe5e7..7b48c0038d98fb107ea25dc7ecd2645501429115 100755 --- a/s3/upload-all-to-s3.sh +++ b/s3/upload-all-to-s3.sh @@ -6,6 +6,7 @@ s3_key="${1}" s3_secret="${2}" s3_host="${3}" s3_bucket="${4}" +data="${5}" root_path=$(dirname $(realpath "${BASH_SOURCE[0]}")) @@ -111,11 +112,11 @@ pref973 pref974 pref976" -if test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket"; then - echo "Usage: ${0} <s3_key> <s3_secret> <s3_host> <s3_bucket>" +if test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket" || test -z "$data"; then + echo "Usage: ${0} <s3_key> <s3_secret> <s3_host> <s3_bucket> <data>" exit 1 fi for i in $administrations; do - ${root_path}/upload-to-s3.sh "${i}" "$s3_key" "$s3_secret" "$s3_host" "$s3_bucket" || true + ${root_path}/upload-to-s3.sh "${i}" "$s3_key" "$s3_secret" "$s3_host" "$s3_bucket" "$data" || true done diff --git a/s3/upload-to-s3.sh b/s3/upload-to-s3.sh index 90a2ac47915b6eb1deb36290f94d04fa2fefb711..7d0d37862a64cd5b7d79684f08e7fa90c4f11d71 100755 --- a/s3/upload-to-s3.sh +++ b/s3/upload-to-s3.sh @@ -7,13 +7,16 @@ s3_key="${2}" s3_secret="${3}" s3_host="${4}" s3_bucket="${5}" +data="${6}" -if test -z "$pref" || test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket"; then - echo "Usage: ${0} <pref> <s3_key> <s3_secret> <s3_host> <s3_bucket>" +if test -z "$pref" || test -z "$s3_key" || test -z "$s3_secret" || test -z "$s3_host" || test -z "$s3_bucket" || test -z "$data"; then + echo "Usage: ${0} <pref> <s3_key> <s3_secret> <s3_host> <s3_bucket> <data>" exit 1 fi -cd "$(dirname $(realpath "${BASH_SOURCE[0]}"))/../data/${pref}/raa" +data=$(realpath "${data}") + +cd "${data}/${pref}/raa" cd "../../" file="${pref}.zip"