#!/bin/bash
#
# Version: 0.2
# Author: Peter Dyson <pete@geekpete.com>
# Purpose: A workaround until Citrix gets their act together and packages up a better install script.
# What it does: downloads and installs Thawte root certs in the required location.
#
# CHANGELOG
#            v0.1 - initial release
#   20090522 v0.2 - Thawte dropped a new cert zip file on their site, uses different subdirs, broke the script, fixed.
#


# change the install dir to be whatever you need, you may have used a local dir in your homedir,etc.
CERTINSTALLDIR="/usr/lib/ICAClient/keystore/cacerts"
STARTDIR=$PWD

#echo $CERTINSTALLDIR
#exit
echo Current directory is: $STARTDIR
echo Creating temp download dir in $STARTDIR...
mkdir cert_download
cd cert_download
echo Fetching Thawte Root Certs...
wget https://www.verisign.com/support/thawte-roots.zip
echo Unzipping Thawte Root Certs...
unzip thawte-roots.zip
echo Copying Thawte Root Certs to $CERTINSTALLDIR and renaming them...
echo This step uses sudo, enter your user password to run this step as root:
sudo cp "Thawte SSLWeb Server Roots/thawte Premium Server CA/Thawte Premium Server CA.cer" $CERTINSTALLDIR/ThawtePremiumServerCA.crt
#sudo cp "Thawte Server Roots"/ThawtePremiumServerCA.cer $CERTINSTALLDIR/ThawtePremiumServerCA.crt

cd $STARTDIR
echo Removing temp download dir...
rm -rf cert_download
echo Citrix SSL Cert fix complete!

