#!/bin/bash

echo Downloading file list
rm -f ./file_list.txt
wget  http://release.zlya.net/board/camera/file_list.txt

echo Downloading files...
while read -r line
do
	if [ "$line" != "" ]
	then
		echo Downloading $line...
		rm -f $line
		wget -nvc http://release.zlya.net/board/camera/$line
		if [ $? != 0 ]
		then
			echo ERROR: Download $line failed!
			exit
		fi
		if [[ "$line" == *.sh ]]
		then
			chmod +x $line
		fi	
	fi
done < ./file_list.txt

#scp -r root@116.62.202.15:/root/release/board/camera .
echo Files downloaded.
