diff --git a/media.sh b/media.sh new file mode 100755 index 0000000..1e15dd4 --- /dev/null +++ b/media.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail + +BUCKET="$(basename "$(cd "$(dirname "$0")" && pwd)")" +ENDPOINT="https://s3.hantim.net" +LOCAL_DIR="static/media" + +usage() { + echo "usage: $0 " + echo " pull download media from garage to $LOCAL_DIR/" + echo " push upload media from $LOCAL_DIR/ to garage" + exit 1 +} + +[[ $# -eq 1 ]] || usage + +case "$1" in + pull) + aws --endpoint-url "$ENDPOINT" s3 sync "s3://$BUCKET/" "$LOCAL_DIR/" + ;; + push) + aws --endpoint-url "$ENDPOINT" s3 sync "$LOCAL_DIR/" "s3://$BUCKET/" + ;; + *) + usage + ;; +esac diff --git a/static/index.html b/static/index.html index b1d368d..b2447b8 100644 --- a/static/index.html +++ b/static/index.html @@ -84,3 +84,6 @@ + +