mirror of https://github.com/kubernetes/kops.git
40 lines
751 B
Bash
Executable File
40 lines
751 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
PUBLIC=1
|
|
|
|
if [[ "$1" == "--private" ]]; then
|
|
PUBLIC=
|
|
shift
|
|
fi
|
|
|
|
SRC=$1
|
|
DEST=$2
|
|
|
|
if [[ -z "${SRC}" ]]; then
|
|
echo "syntax: $0 [--private] <src> <dest>"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "${DEST}" ]]; then
|
|
echo "syntax: $0 [--private] <src> <dest>"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${DEST:0:5}" == "s3://" ]]; then
|
|
aws s3 sync ${PUBLIC:+--acl public-read} ${SRC} ${DEST}
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${DEST:0:5}" == "gs://" ]]; then
|
|
gsutil -h "Cache-Control:private,max-age=0" rsync -r ${PUBLIC:+-a public-read} ${SRC} ${DEST}
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${DEST:0:6}" == "oss://" ]]; then
|
|
aliyun oss cp ${PUBLIC:+--acl public-read} -r -f --include "*" ${SRC}/ ${DEST}
|
|
exit 0
|
|
fi
|
|
|
|
echo "Unsupported destination - supports s3://, gs:// and oss:// urls: ${DEST}"
|
|
exit 1
|