blob: 57af72c40947eb2613122b1fd304fbd91257a9ba (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env bash
# This file is part of MXE. See LICENSE.md for licensing information.
# cron job running on our DigitalOcean server fetching and uploading
# package tarballs to MXE Amazon S3 backup server.
# This also acts as a CI to file issue on GitHub if download fails.
# DigitalOcean server: mirror.mxe.cc
# IP: 104.131.71.203
# v6: 2604:a880:800:10::156:f001 2604:a880:800:10::1
#
# Admins: https://api.github.com/orgs/mxe/members
# Keys: https://github.com/<user>.keys or https://api.github.com/users/<user>/keys
#
# The script uses s3cmd to sync package tarballs:
# http://s3tools.org/s3cmd
# Manual switch to enable/disable issue filing on GitHub.
# Useful to prevent the same issue from being filed multiple times
file_issue=false
# List of plugin dirs to include in downloads
# Can't include all subdirs since some affect versions
plugin_dirs=`echo plugins/{apps,luarocks,native,tcl.tk}`
cd ~/mxe && git pull
# Test downloading without falling back to S3 download server.
# All log is stored in tmp-download-log.
if ! ( \
cd ~/mxe && \
make download -k MXE_NO_BACKUP_DL=true MXE_VERBOSE=true \
MXE_PLUGIN_DIRS="$plugin_dirs" \
2>&1 >tmp-download-log \
) && $file_issue; then
# If one or more download process fails, upload log to sprunge.us (a
# pastebin-like text storage service). Store the returned URL in tmp-url.
cat ~/mxe/tmp-download-log | curl -F 'sprunge=<-' http://sprunge.us \
>~/mxe/tmp-url
# Use a fake "editor" to format the issue
EDITOR=~/mxe/tools/fake-editor ghi open -L bug -- mxe/mxe
fi
cd ~/mxe && make clean-junk MXE_PLUGIN_DIRS="$plugin_dirs"
s3cmd sync --acl-public ~/mxe/pkg/* s3://mxe-pkg/
rm -f ~/mxe/tmp-download-log ~/mxe/tmp-url
|