#!/bin/bash

        temp=$(cat /root/.func/update/version.txt | awk -F'v' '{print $2}' |  awk -F'.' '{print $1}' )
        temp1=133
        if [ $temp -gt $temp1 ]
        then
                echo current version is newer
		rm update.sh
                exit
        fi
rm updateImageServer.sh
wget https://heltec.krasnodar.one/download/HT-M2808/updateImageServer.sh 
chmod +x updateImageServer.sh
sha_cal=$(sha256sum updateImageServer.sh | awk -F' ' '{print $1}')
if [ "$sha_cal" = "c0aa65f450a493e9f17c88ce1687d25ab548c4bb4e5868502a40abc114e3a240" ]
then
	echo "checksum OK"
	cp updateImageServer.sh /root/.func/
	sync
	systemctl restart rc.local 
	rm update.sh
	rm updateImageServer.sh
fi
