26 October 2009

Automatic Adobe Flash on amd64

AMD64 LogoImage via WikipediaUPDATE: Adobe has closed down their webpage which hosts the 64-bit version of Flash for Linux so the method described below no longer works! :(

Yes, apparently I have had a one month lurch. Things have been hectic as the new school year started and I couldn't really believe that almost a month has passed since my last effort!

The state of Adobe's Flash Player on Linux is a sad story, even more so for the next architecture PCs are migrating to (AMD64). The simple truth is that the modern web is unusable sans Flash for the common web surfer.
While I and others would like to see it displaced by open standards, such as the forthcoming HTML5 with the video and canvas elements, that is still far on the horizon and Adobe isn't exactly idling.

Okay, we Linux users are a pretty small part of the global pie, but we're arguably more technically savvy than the average computer drone. The 32-bit (x86) version of Flash player can easily be installed from Adobe's site but the amd64 flavour is still an exercise in bash. The software is still deemed to be of alpha quality so perhaps that is the reason why a more friendly install procedure isn't available. Luckily, Linux geeks like Romeo-Adrian Cioaba are friendly. How quickly a need is scratched now that Ubuntu has gained so much traction!

By modifying his script I have managed to make a version that will automatically download and install the latest version available from Adobe Labs. Be warned: I make no warranties that this procedure will work indefinitely or that it may not harm your computer. But the code is available for you to analyse so you may convince yourself of its correctness. Best way to learn is probably to execute each line by hand to see what happens. The manuals for the commands are your friends. :) Also, know that whenever you wish to install the version that comes with ubuntu, you need to run just the commands in the first 17 lines. Remember that, write it down somewhere, like in ~/FLASH_UPGRADE.txt

# Script  created by
# Romeo-Adrian Cioaba romeo.cioaba@spotonearth.com
# Jaša Bartelj jasa.bartelj@gmail.com

echo "Stopping any Firefox that might be running."
sudo killall -9 firefox

echo "Removing any other flash plugin previously installed."
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-pl
ugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo rm -rfd /usr/lib/nspluginwrapper

echo "Installing Flash Player 10."
cd /tmp
# EDIT: when releasing flash 10.1 adobe changed the site's address.
# I want permalinks! :(  --Jasa B.
#wget http://labs.adobe.com/downloads/flashplayer10.html
wget -q http://labs.adobe.com/downloads/flashplayer10_64bit.html
wget `cat flashplayer10_64bit.html | egrep -o "http:.*"|cut -d\" -f1|grep linux-x86_64.so.tar.gz`
ARCHIVE=`ls libflashplayer-*.linux-x86_64.so.tar.gz`
echo "Version is $ARCHIVE."
tar zxvf $ARCHIVE
sudo cp libflashplayer.so /usr/lib/mozilla/plugins/ 

echo "Linking the libraries so Firefox and apps built on XULRunner can find it."
sudo ln -sf /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox-addons/plugins/
sudo ln -sf /usr/lib/mozilla/plugins/libflashplayer.so  /usr/lib/xulrunner-addons/plugins/

# now doing some cleaning up:
sudo rm -rf flashplayer10.html
sudo rm -rf libflashplayer.so
sudo rm -rf $ARCHIVE
The most complicated part is really just snipping the HTML for the URL of the archive. Please, enjoy and comment.
Enhanced by Zemanta