Script Syntax on untarring file.

Trying to write a script to do the following.

scp to all redhat linux host and install a antivirus tarball. Need to know what additional syntax to use to untar the file and execute the install.sh inside the tarball and then remove the tarball on all remote hosts.

Here is what I have so far.

#!/bin/ksh
PATH=/usr/bin:/usr/sbin:/opt/local/bin:/usr/local/bin
PGM=`basename $0`
HOSTS=$1

[[ -z $HOSTS ]] && HOSTS="`grep -v \# /opt/local/etc/hosts|grep -i linux|nawk '{print $1}'`"

echo "$PGM: Installing Sophos AntiVirus Software"
for host in $HOSTS
do
printf "o PROCESSING HOST: %-20s\n" $host
ping $host 1>/dev/null 2>&1;
if (( $? )) ; then
echo "--Cannot contact host $host";
else
scp -q $host:/shares/cfgscripts/install.sophos.tar ${host:/opt/sophos-av $DIR/
esac
fi
fi;
done

Need some assistance on what to insert after scp the tarball to all the host.

to extract a tarfile:

tar -xvf file.name

. . . . prefaced with appropriate ssh commands to do remotely.

if the files within the tar file are fully qualified directory-wise, this should work with the fullpath of file.name.
if they're not, and they're just relative, you'll need to do something like:

ssh hostname 'cd /there ; tar -xvf file.name'

yeah that's right

assuming your tar is install.sophos.tar containing a folder install.sophos
adding this should do the job

ssh $host 'cd /there ; tar -xvf install.sophos.tar;
. ./install.sophos/install.sh; rm -rf install.sophos'