#! /bin/sh

##################################################
#
#   This script is originally created to fix
#   flash-player for Mozilla Firefox at
#   Ubuntu amd64 systems.
#
#   Written by: orrie <code@orrie.org>
#   Web: http://projects.orrie.org
#   Contact: http://www.orrie.no/contact/
#
##################################################

# Get the nspluginwrapper packages
wget http://pub.orrie.org/ubuntu/packages/nspluginwrapper/nspluginwrapper-0.9.91.3-1.x86_64.rpm
wget http://pub.orrie.org/ubuntu/packages/nspluginwrapper/nspluginwrapper-i386-0.9.91.3-1.x86_64.rpm

# Get Adobe Flash
wget http://pub.orrie.org/ubuntu/packages/flashplayer/install_flash_player_9_linux.tar.gz
tar -zxf install_flash_player_9_linux.tar.gz

# Install 32 bit wrapper and alien
sudo apt-get install ia32-libs lib32asound2 lib32ncurses5 ia32-libs-sdl ia32-libs-gtk gsfonts gsfonts-x11 linux32
sudo apt-get install alien

# Installation for gnome browsers
sudo ln -s /usr/lib/nspluginwrapper/x86_64/npconfig /usr/bin/nspluginwrapper
sudo alien -d nspluginwrapper*.rpm
sudo dpkg -i nspluginwrapper*.deb
sudo mkdir /usr/lib/mozilla/plugins32
sudo mv install_flash_player_9_linux/libflashplayer.so /usr/lib/mozilla/plugins32
sudo nspluginwrapper -i /usr/lib/mozilla/plugins32/libflashplayer.so

# The plugin has to be available for Firefox right?
sudo ln -s /usr/lib/mozilla/plugins/npwrapper.so /usr/lib/mozilla-firefox/plugins/
sudo ln -s /usr/lib/mozilla/plugins/npwrapper.libflashplayer.so /usr/lib/mozilla-firefox/plugins/


# Clean up
sudo rm -R install_flash_player_9_linux
sudo rm install_flash_player_9_linux.tar.gz
sudo rm nspluginwrapper*

# Echo text
echo "Try restarting your Firefox now, the Flash should work now ;)\nIf any problems, report it on http://www.orrie.no\nPerhaps you get credits by reporting the fault ;)"

