Support s3 backup upload without session tokens

This commit is contained in:
Johannes Zellner
2016-06-13 19:10:08 +02:00
parent c691b75344
commit ef200fcc85
3 changed files with 21 additions and 13 deletions

View File

@@ -12,8 +12,8 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
exit 0
fi
if [ $# -lt 8 ]; then
echo "Usage: backupapp.sh <appid> <s3 config url> <s3 data url> <access key id> <access key> <session token> <region> <password>"
if [ $# -lt 7 ]; then
echo "Usage: backupapp.sh <appid> <s3 config url> <s3 data url> <access key id> <access key> <region> <password> [session token]"
exit 1
fi
@@ -25,9 +25,12 @@ readonly s3_config_url="$2"
readonly s3_data_url="$3"
export AWS_ACCESS_KEY_ID="$4"
export AWS_SECRET_ACCESS_KEY="$5"
export AWS_SESSION_TOKEN="$6"
export AWS_DEFAULT_REGION="$7"
readonly password="$8"
export AWS_DEFAULT_REGION="$6"
readonly password="$7"
if [ $# -gt 7 ]; then
export AWS_SESSION_TOKEN="$8"
fi
readonly now=$(date "+%Y-%m-%dT%H:%M:%S")
readonly app_data_dir="${DATA_DIR}/${app_id}"

View File

@@ -12,8 +12,8 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
exit 0
fi
if [ $# -lt 6 ]; then
echo "Usage: backupbox.sh <s3 url> <access key id> <access key> <session token> <region> <password>"
if [ $# -lt 5 ]; then
echo "Usage: backupbox.sh <s3 url> <access key id> <access key> <region> <password> [session token]"
exit 1
fi
@@ -21,9 +21,13 @@ fi
s3_url="$1"
export AWS_ACCESS_KEY_ID="$2"
export AWS_SECRET_ACCESS_KEY="$3"
export AWS_SESSION_TOKEN="$4"
export AWS_DEFAULT_REGION="$5"
password="$6"
export AWS_DEFAULT_REGION="$4"
password="$5"
if [ $# -gt 5 ]; then
export AWS_SESSION_TOKEN="$6"
fi
now=$(date "+%Y-%m-%dT%H:%M:%S")
BOX_DATA_DIR="${HOME}/data/box"
box_snapshot_dir="${HOME}/data/snapshots/box-${now}"