Skip to content

Instantly share code, notes, and snippets.

@elleryq
Last active December 4, 2015 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elleryq/a9968ae7e8656dc4b055 to your computer and use it in GitHub Desktop.
Save elleryq/a9968ae7e8656dc4b055 to your computer and use it in GitHub Desktop.
Ubuntu Swift-2.2 installer
#!/bin/bash
TARBALL="swift-2.2.tar.gz"
TARBALL_SIG="swift-2.2.tar.gz.sig"
SWIFT_TARBALL_URL="https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz"
SWIFT_TARBALL_SIG_URL="https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz.sig"
DESTDIR="/opt/swift-2.2"
if [ ! -e "$TARBALL" ]; then
wget "$SWIFT_TARBALL_URL" -O "$TARBALL"
fi
if [ ! -e "$TARBALL_SIG" ]; then
wget "$SWIFT_TARBALL_SIG_URL" -O "$TARBALL_SIG"
fi
gpg --keyserver hkp://pool.sks-keyservers.net \
--recv-keys \
'7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD' \
'1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F'
gpg --keyserver hkp://pool.sks-keyservers.net --refresh-keys Swift
LANG=C gpg --verify swift-2.2.tar.gz.sig | grep "BAD signature"
if [ $? -eq 0 ]; then
echo "Bad signature, stop to install."
exit -1
fi
if [ ! -e "$DESTDIR" ]; then
tar xf $TARBALL
sudo mv swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 "$DESTDIR"
fi
sudo apt-get install clang
echo
echo "If you are using bash, please add the following text in ~/.bashrc"
echo "If you are using zsh, the file is ~/.zshrc"
echo
echo "export PATH=$DESTDIR/usr/bin:\${PATH}"
echo
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment