Skip to content

Instantly share code, notes, and snippets.

@jeremyBanks
Created July 26, 2008 10:51
Show Gist options
  • Save jeremyBanks/2633 to your computer and use it in GitHub Desktop.
Save jeremyBanks/2633 to your computer and use it in GitHub Desktop.
[2010-01] downloading and verifying python, noobing bash and gpg
#!/bin/bash
# Fuck this, I don't know bash.
GENERAL=2.6
SPECIFIC=2.6b2
BZFILE="Python-$SPECIFIC.tar.bz2"
BZURL="http://www.python.org/ftp/python/$GENERAL/$BZFILE"
ASCFILE="Python-$SPECIFIC.tar.bz2.asc"
ASCURL="http://www.python.org/download/releases/$GENERAL/$ASCFILE"
echo "Downloading tarball..." 1>&2
if true || curl -o "$BZFILE" "$BZURL"; then
echo "Downloading signature..." 1>&2
if true || curl -o "$ASCFILE" "$ASCURL"; then
if false && gpg --verify "$ASCFILE" "$BZFILE" &> /dev/null; then
echo "Signature verified." 1>&2
signed=true
else
echo "Signature verification failed." 1>&2
signed=false
fi
else
echo "Tarball signature download failed." 1>&2
signed=false
fi
if $signed; then
true
else
answer="?"
while [ $answer != "y" ] && [ $answer != "n" ]; do
read -p "Would you like to continue installation? (y/n) " -n 1 answer 1>&2; echo 1>&2
done
fi
if $signed || [ $answer == "y" ]; then
else
echo "Installation terminated."
false
fi
else
echo "Download failed." 1>&2
false
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment