File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22# This is a script used in travis-ci to install swift
3- set -ex
3+ set -euxo pipefail
44
55. /etc/lsb-release
66if [ " $DISTRIB_CODENAME " = " trusty" ]; then
7- SWIFT_TARBALL= " swift-4.0.3-RELEASE- ubuntu14.04.tar.gz"
7+ SWIFT_URL= ' https:// swift.org/builds/swift -4.0.3-release/ubuntu1404/swift-4.0.3- RELEASE/swift-4.0.3-RELEASE- ubuntu14.04.tar.gz'
88 SWIFT_HASH=" dddb40ec4956e4f6a3f4532d859691d5d1ba8822f6e8b4ec6c452172dbede5ae"
9- SWIFT_URL=" https://swift.org/builds/swift-4.0.3-release/ubuntu1404/swift-4.0.3-RELEASE/$SWIFT_TARBALL "
109else
11- SWIFT_TARBALL= " swift-4.0.3-RELEASE- ubuntu16.04.tar.gz"
10+ SWIFT_URL= ' https:// swift.org/builds/swift -4.0.3-release/ubuntu1604/swift-4.0.3- RELEASE/swift-4.0.3-RELEASE- ubuntu16.04.tar.gz'
1211 SWIFT_HASH=" 9adf64cabc7c02ea2d08f150b449b05e46bd42d6e542bf742b3674f5c37f0dbf"
13- SWIFT_URL=" https://swift.org/builds/swift-4.0.3-release/ubuntu1604/swift-4.0.3-RELEASE/$SWIFT_TARBALL "
1412fi
1513
16- mkdir -p " $HOME " /.swift
17- pushd " $HOME " /.swift
18- wget -N -c " $SWIFT_URL "
19- echo " $SWIFT_HASH $SWIFT_TARBALL " > hash.txt
20- shasum -a 256 -c hash.txt
21- popd
14+ check () {
15+ echo " $SWIFT_HASH $TGZ " | sha256sum --check
16+ }
17+
18+ TGZ=" $HOME /.swift/swift.tar.gz"
19+ mkdir -p " $( dirname " $TGZ " ) "
20+ if ! check >& /dev/null; then
21+ rm -f " $TGZ "
22+ curl --location --silent --output " $TGZ " " $SWIFT_URL "
23+ check
24+ fi
2225
2326mkdir -p /tmp/swift
24- pushd /tmp/swift
25- tar -xf " $HOME " /.swift/" $SWIFT_TARBALL " --strip 1
26- popd
27+ tar -xf " $TGZ " --strip 1 --directory /tmp/swift
You can’t perform that action at this time.
0 commit comments