s3/s3upload.sh hinzugefügt
This commit is contained in:
parent
07bb9a8f1a
commit
76fe832e66
1 changed files with 25 additions and 0 deletions
25
s3/s3upload.sh
Normal file
25
s3/s3upload.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# S3 upload script for CI-Builds
|
||||
# ./s3upload.sh bucket file.zip | Warning if file is in folder folder gets created on path!
|
||||
|
||||
s3_bucket=$1
|
||||
s3_file=$2
|
||||
|
||||
# Needed environment vars:
|
||||
# s3_host
|
||||
# s3_key
|
||||
# s3_secret
|
||||
|
||||
resource="/${s3_bucket}/${s3_file}"
|
||||
content_type="application/octet-stream"
|
||||
date=`date -R`
|
||||
_signature="PUT\n\n${content_type}\n${date}\n${resource}"
|
||||
signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64`
|
||||
|
||||
curl -X PUT -T "${s3_file}" \
|
||||
-H "Host: ${s3_host}" \
|
||||
-H "Date: ${date}" \
|
||||
-H "Content-Type: ${content_type}" \
|
||||
-H "Authorization: AWS ${s3_key}:${signature}" \
|
||||
https://${s3_host}${resource}
|
Loading…
Reference in a new issue