#!/bin/bash

## This script copies all plugins from firefox-2.0.0.1/plugins directory
## to the new firefox-2.0.0.2/plugins directory, thus ensuring that the
## user is still able to see multimedia pages.
## This is a workaround for the lack of plugins in the proper mozilla/plugins
## directory in the base ISO install.

## The user should run this script as root.

# Create working environment
mkdir /tmp/firefox-2.0.0.2
cd /tmp/firefox-2.0.0.2/

# Get the firefox 2.0.0.2 package from my site
wget http://www.mooworld.org/zenwalk/packages/firefox-2.0.0.2-i686-44.0.tgz
wget http://www.mooworld.org/zenwalk/packages/firefox-2.0.0.2-i686-44.0.md5

# This checks to see if the package matches the md5 signature created for it.
echo "Checking md5 signature ..."
md5sum -c firefox-2.0.0.2-i686-44.0.md5

if [[ $? == 0 ]]
  then 
    # Check to see if the plugins are needed, and then Install the package
    if [[ -d /usr/lib/firefox-2.0.0.1 ]]
      then 
        echo "Copying plugins from previous install ...";
        cp /usr/lib/firefox-2.0.0.1/plugins/* /usr/lib/mozilla/plugins/;
        upgradepkg --install-new firefox-2.0.0.2-i686-44.0.tgz;
      else
        upgradepkg --install-new firefox-2.0.0.2-i686-44.0.tgz;
    fi
  else
    echo "Package md5 signature does not match.  Please download again."
fi

