"Universal Install Script", by Randall Munroe, licensed under Creative Commons Attribution-NonCommercial 2.5 License
Alt Text
The failures usually don't hurt anything, and if it installs several versions, it increases the chance that one of them is right. (Note: The 'yes' command and '2>/dev/null' are recommended additions.)