Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 25 lines (19 sloc) 728 Bytes
#!/bin/bash
set -euo pipefail
set -o errexit
set -o errtrace
IFS=$'\n\t'
export S3_ACL=${S3_ACL:-private}
test $MOUNT_POINT
rm -rf ${MOUNT_POINT}
mkdir -p ${MOUNT_POINT}
if [ "$IAM_ROLE" == "none" ]; then
export AWSACCESSKEYID=${AWSACCESSKEYID:-$AWS_ACCESS_KEY_ID}
export AWSSECRETACCESSKEY=${AWSSECRETACCESSKEY:-$AWS_SECRET_ACCESS_KEY}
echo 'IAM_ROLE is not set - mounting S3 with credentials from ENV'
/usr/bin/s3fs ${S3_BUCKET} ${MOUNT_POINT} -o nosuid,nonempty,nodev,allow_other,default_acl=${S3_ACL},retries=5
else
echo 'IAM_ROLE is set - using it to mount S3'
/usr/bin/s3fs ${S3_BUCKET} ${MOUNT_POINT} -o iam_role=${IAM_ROLE},nosuid,nonempty,nodev,allow_other,default_acl=${S3_ACL},retries=5
fi
exec "$@"