summaryrefslogtreecommitdiffstats
path: root/tools/s3-fetch-and-sync
blob: 6c26ab75fcb60d722f06add2546213c770e3d713 (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
#!/bin/sh

#ec2-174-129-78-72.compute-1.amazonaws.com
#http://s3tools.org/s3cmd

# File issue on GitHub if download fails.
file_issue=true

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 \
            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 -- TimothyGu/tmp
    # EDITOR=~/mxe/tools/fake-editor ghi open -- mxe/mxe
fi

cd ~/mxe && make clean-junk
s3cmd sync --acl-public ~/mxe/pkg/* s3://mxe-pkg/
rm -f ~/mxe/tmp-download-log ~/mxe/tmp-url