#!/bin/bash
# Script for DLL downloading
if [ "$compress" <> 'tar' ] and if [ "$compress" <> 'tar.gzip' ] and if [ "$compress" <> 'zip' ] and if [ "$compress" <> 'none' ] and if [ "$compress" <> 'tar.bzip2' ]
then {
   echo "Compression format not supported. Exiting."
   exit 3
}
if [ "$compress" == 'none' ]
then {
   $compress = 'dll'
}
wget -P /var/tmp "$server"/"$serverpath"/"$dllname"."$compress"
if [ "$compress" == 'tar.gz' ]
then {
   gzip -d /var/tmp/"$dllname".tar.gz
   rm /var/tmp/"$dllname".tar.gz
}
if [ "$compress" == 'tar.bz2' ]
then {
   bzip2 -d /var/tmp/"$dllname".tar.bz2
   rm /var/tmp/"$dllname".tar.bz2
}
if [ "$compress" <> 'zip' ] and if [ "$compress" <> 'dll' ]
then {
   tar -x -k -f /var/tmp/"$dllname".tar
   rm /var/tmp/"$dllname".tar
}
if [ "$compress" == 'zip' ]
then {
   unzip -n /var/tmp/"$dllname".zip -d /var/tmp
   rm /var/tmp/"$dllname".zip
}
cp /var/tmp/"$dllname".dll "$dest"/"$dllname".dll
exit 0