#!/bin/bash
sudo aptitude -y install libqt4-webkit
ge=`which googleearth`
if [ -n "$ge" ]; then
## get the path and check if it is a symlink
if [ -h "$ge" ]; then
real_path=`readlink -e $ge`
dir_path=`dirname $real_path`
else
real_path=`dirname $ge`
fi
## backup original Qt4 libraries
for i in `ls $dir_path | grep libQt`; do
sudo mv -v $dir_path/$i $dir_path/$i"_backup"
done
## backup original Qt4 plugins
for j in `ls $dir_path/plugins/imageformats | grep libq`; do
sudo mv -v $dir_path/plugins/imageformats/$j $dir_path/plugins/imageformats/$j"_backup"
done
## create a new qt.conf file
cat > $HOME/qt.conf << "EOF"
[Paths]
Documentation=/usr/share/doc
Libraries=/usr/lib
Plugins=/usr/lib/qt4/plugins
Translations=/usr/lib/qt4/translations
EOF
sudo mv -v $dir_path/qt.conf $dir_path/qt.conf_backup
sudo mv -v $HOME/qt.conf $dir_path
elif [ -z "$ge" ]; then
echo -e "You don't have Google Earth installed!\n"
exit
fi
exit 0