#!/bin/bash

#Version testing
echo "<<=========== 数据源更新[开始] ==========>>"
date '+时间 : %Y-%m-%d %H:%M:%S' >> /home/start.log
echo "<<=========== 数据源更新[开始] ==========>>" >> /home/start.log
echo "###########################################" >> /home/start.log

echo "Network test"
IUSER=$1

echo "SYS_version test"
sysVer="`cat /etc/issue.net`"
nowVer="Ubuntu 20.04 LTS"
if [[  ${sysVer} =~ ${nowVer} ]];then
        echo "SYS_version ok"
        echo "SYS_version ok" >> /home/start.log
else
        echo "SYS_version err"
        echo "SYS_version err" >> /home/stop.log
	exit 1;
fi

if [ ! -f ./sh/rar/jdk.7z ] ;then
	echo "download jdk" 
	wget -P ./sh/rar/ http://simba.whhsn.cn:7374/init/doc/jdk.7z
fi

#File detection
#if [ ! -f ./sh/rar/jdk.7z -o ! -f ./sh/doc/javahome -o ! -f ./sh/doc/whhsn.x -o ! -f ./sh/doc/whhsn.y ] ;then
		
		if [ ! -f ./sh/rar/jdk.7z ];then
			FA=" sh/rar/jdk \n"
		fi
		if [ ! -f ./sh/doc/javahome ];then
			FB=" sh/doc/javahome \n"
		fi		
		if [ ! -f ./sh/doc/whhsn.x ] ;then
			FC=" sh/doc/whhsn.x \n"
		fi
		if [ ! -f ./sh/doc/whhsn.y ] ;then
			FD=" sh/doc/whhsn.y \n"
		fi
		echo -e "file not found :\n${FA}${FB}${FC}${FD}"
		echo "<<==================================>>" >> /home/start.log
		echo "<<==  check_ubuntu install OK!!!  ==>>" >> /home/start.log
		echo "<<==================================>>" >> /home/start.log
#fi
