blob: bd3fbb497da05933c333b111cb02425a72235ba4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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.'
|