#!/bin/sh
# upgrade DCM to platinum v2
wget http://www.guralp.com/platinum/reimage/files/CMG-DCM-mk2x.tar.gz || ( 
    echo "Cannot download CMG-DCM-mk2x.tar.gz: check networking"; exit; ) 
wget http://www.guralp.com/platinum/reimage/files/support.tar.gz || (  
    echo "Cannot download support.tar.gz: check networking"; exit; ) 
wget http://www.guralp.com/platinum/reimage/files/upgrade-to-platinum.sh || (  
    echo "Cannot download upgrade-to-platinum.sh: check networking"; exit; ) 

MD5a="`md5sum CMG-DCM-mk2x.tar.gz`" 
MD5b="`md5sum support.tar.gz`" 
MD5c="`md5sum upgrade-to-platinum.sh`" 

SUMa=53ea54b1623523a46829cbf0080f865a 
SUMb=ced24e396c4f71dc73683de1d5dae264 
SUMc=46de048d2ff7c1754ade33c1b48aaae2

OKa=`expr "$MD5a" : $SUMa` 
OKb=`expr "$MD5b" : $SUMb` 
OKc=`expr "$MD5c" : $SUMc` 

if [ $OKa = 32 -a $OKb = 32 -a $OKc = 32 ] ; then 
    ### Un-comment either: 
    sh upgrade-to-platinum.sh dhcp 
    ### or (after editing - see the notes): 
    ### sh upgrade-to-platinum.sh static 172.16.0.1/16 172.16.255.254 
else 
    echo "Checksum Mismatch! - retry file transfer" 
fi 
