diff options
Diffstat (limited to 'publish.sh')
-rwxr-xr-x | publish.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..bd3fbb4 --- /dev/null +++ b/publish.sh @@ -0,0 +1,27 @@ +#!/bin/sh +RCLONE_ENDPOINT="${RCLONE_ENDPOINT:-linode-fr:/blankplays.pommicket.com/}" +S3CMD_HOST="${S3_HOST:-fr-par-1.linodeobjects.com}" +S3CMD_ENDPOINT="${S3_ENDPOINT:-s3://blankplays.pommicket.com}" + +EXCL2= +if [ "$1" = 'skip-challenges' ]; then + EXCL2='--exclude=/challenges-{{.*}}' +fi + +ls pub +printf "Copy this stuff to ${RCLONE_ENDPOINT} [y/n]? " +read ok +if [ "$ok" != 'y' ]; then + echo 'Aborted.' + exit 1 +fi + +rclone -P --transfers=16 --checkers=16 --exclude=/blankplays.js $EXCL2 --s3-acl=public-read copy pub/ "$RCLONE_ENDPOINT" || exit 1 +gzip -9 -c pub/blankplays.js > blankplays.gz.js || exit 1 +s3cmd -P -m 'text/javascript; charset=utf-8' \ + --host="$S3CMD_HOST" \ + --host-bucket='%(bucket)s.'"$S3CMD_HOST" \ + --add-header 'Content-Encoding: gzip' \ + put blankplays.gz.js "$S3CMD_ENDPOINT/blankplays.js" || exit 1 +rm blankplays.gz.js +echo 'Done.' |