#!/bin/sh

LIST=`/bin/ls *pz2 *az2`
LAZ2=`echo $LIST | grep ".az2" -`
LPZ2=`echo $LIST | grep ".pz2" -`

if test "$LAZ2$LPZ2" != "" ; then

echo -e "\n\
The build can take hours, typically 2 hours on a 800 MHz PentiumIII,\n\
possibly one day on a slow machine.\n\n\
More than one hundred of MBytes of free hard disk space is needed.\n\
You have been warned !!\n"

else

echo -e "No .az2 or .pz2 data in this directory!!\n
The build script should be run in the directory where the data are!!"
exit
fi


if [ -r 4320x2160-6x6.pz2 ] ; then

  if ! [ -r 2160x1080-3x3.pz2 ] ; then
    earthview -file 4320x2160-6x6.pz2 -w 2160 -h 1080 -pack 3 3 \
              -oceanbit -verbose
  fi
  if ! [ -r 1080x540-1x1.pz2 ] ; then
    earthview -file 4320x2160-6x6.pz2 -w 1080 -h 540 -pack 1 1 \
              -oceanbit -verbose
  fi
fi

if [ -r 43200x21600-60x60.az2 ] ; then

  if ! [ -r 14400x7200-20x20.az2 ] ; then
    earthview -file 43200x21600-60x60.az2 -w 14400 -h 7200 -pack 20 20 \
              -oceanbit -verbose
  fi
  if ! [ -r 4320x2160-6x6.az2 ] ; then
    earthview -file 43200x21600-60x60.az2 -w 4320 -h 2160 -pack 6 6 \
              -oceanbit -verbose
  fi
fi


if [ -r 4320x2160-6x6.az2 ] ; then

  if ! [ -r 1440x720-2x2.az2 ] ; then
    earthview -file 4320x2160-15x15.az2 -w 1440 -h 720 -pack 2 2 \
              -oceanbit -verbose
  fi
fi

echo "OK. This is done !!!"
