#!/bin/bash
#       hintupdatever
#

PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.


backtitle="Hintsoft Co., Ltd., Shanghai                             http://www.hintsoft.com.cn"
title="diskless updatever"
DIALOG=whiptail

url_path="http://teltorrent.hintsoft.net/xsver/linux/diskless_update.tgz"

update_sh="/tmp/diskless_update.sh"
update_tar="/tmp/diskless_update.tgz"
rm -fr $update_sh
rm -fr $update_tar
echo now get $url_path

cd /tmp/ && /usr/bin/wget $url_path
if [ $? == 0 ] 
then
	tar -xzf /tmp/diskless_update.tgz -C /tmp  2>/dev/null
	if [ -f $update_sh ]
	then
		chmod +x $update_sh
		if [ -n $1 ]
		then
			$update_sh $1
		else
			$update_sh
		fi
	else
		echo "$update_sh not found"
	fi
else
	$DIALOG --backtitle "$backtitle" --title "$title" --msgbox "Get $url_path error !!" 10 70 10
	echo get $url_path error !!
fi
