2022-08-11 22:43:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Checks the environment to see if we have all the requisite components needed
|
|
|
|
# to upload or download from the S3 bucket.
|
|
|
|
|
2022-10-13 13:53:17 +00:00
|
|
|
# Set up logging.
|
|
|
|
log() { echo "⚗️ $(basename $0): $@"; }
|
|
|
|
|
|
|
|
# Move into the root folder.
|
|
|
|
cd $(dirname $(dirname $0))
|
|
|
|
|
|
|
|
for i in S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY S3_ENDPOINT S3_BUCKET
|
2022-08-11 22:43:39 +00:00
|
|
|
do
|
|
|
|
if [ "x${!i}" = "x" ]
|
|
|
|
then
|
2022-10-13 13:53:17 +00:00
|
|
|
log "missing environment variable $i"
|
2022-08-11 22:43:39 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! which s3cmd 2> /dev/null ]
|
|
|
|
then
|
2022-10-13 13:53:17 +00:00
|
|
|
log "cannot find 's3cmd' to execute"
|
2022-08-11 22:43:39 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|