#!/bin/bash

#DEST=/home/ROULETTE/terminal_home/10.5.10.2; 



#TERM je unknown ko se zaganjamo iz beanshell iz symmetric-ds-a je TERM= "unknown", ce pa iz lxterminala je TERM=xterm-256color
#if [ "$TERM" = "unknown" ]; then
if [[ "$TERM" == *"xterm"* ]]; then
        WGET_OPT=" "
else
        #gremo v quiet, ce nismo iz xterm. V primeru ko ni terminala, se zabase output in se prenos ne konca
        WGET_OPT=" -q "
fi

mkdir -p /home/ROULETTE/terminal_home/10.5.10.1
mkdir -p /home/ROULETTE/terminal_home/10.5.10.2
mkdir -p /home/ROULETTE/terminal_home/10.5.10.3
mkdir -p /home/ROULETTE/terminal_home/10.5.10.4
mkdir -p /home/ROULETTE/terminal_home/10.5.10.5
mkdir -p /home/ROULETTE/terminal_home/10.5.10.6
mkdir -p /home/ROULETTE/terminal_home/10.5.10.7
mkdir -p /home/ROULETTE/terminal_home/10.5.10.8
mkdir -p /home/ROULETTE/terminal_home/10.5.10.9
mkdir -p /home/ROULETTE/terminal_home/10.5.10.10
mkdir -p /home/ROULETTE/terminal_home/10.5.10.11
mkdir -p /home/ROULETTE/terminal_home/10.5.10.12
mkdir -p /home/ROULETTE/terminal_home/10.5.10.13
mkdir -p /home/ROULETTE/terminal_home/10.5.10.14
mkdir -p /home/ROULETTE/terminal_home/10.5.10.15


for DEST in /home/ROULETTE/terminal_home/10.5.10.*/; do
echo $DEST
#if [ -d $DEST ]; then 
	mkdir -p $DEST/FIRMWARE; 
	wget $WGET_OPT -O $DEST/FIRMWARE/IGPlatformV6.0.hex http://dubl7696qavg.cloudfront.net/LANDBASE_ROULETTE/RELEASE/IGPlatformV6.0.hex; 
#else
#	echo This station does not exists($DEST); 
#fi

done
