#!/bin/bash
# routine to test, and install a zip file

if [ $# -eq 0 ];then
   echo "Please enter the name of the file to unzip"
    exit 1
fi

if [ ! -f $1 ];then
    echo " $1 not found."
    exit 1
fi
unzip -t $1 autounzip.sh
if [ $? -ne 0 ];then
   echo "Not a zip file, or missing the autounzip.sh file"
   exit 1
fi
unzip $1 -d /tmp autounzip.sh

if [ ! -f /tmp/autounzip.sh ];then
   echo "Autounzip.sh missing from $1, or not executable"
   exit 1
fi
pushd `dirname $1`
/bin/bash /tmp/autounzip.sh
popd

