#!/bin/bash
#
# Author: Danny Steenman
#
# SVN info:
#	$https://subtrac.sara.nl/users/dannys/svn/trunk/

SALI_DIR=/data/sali
SALI_IMAGE_DIR=$SALI_DIR/images

if [ $# -lt 2 ]
then 
	echo "usage: `basename $0` <node_name> <image_name>"
	exit 1
fi

if [ -f /etc/sali/exclude/$2.path ];
then	
	imagename="$2.path"	
else 
	imagename="default.path"
    if [ ! -f /etc/sali/exclude/${imagename} ]
    then
        echo "Exclude file:/etc/sali/exclude/${imagename} does not exists"
        exit 1
    fi
fi

#sali command is used with the userinput
echo "sali getimage --host $1 --image $2 --exclude /etc/sali/exclude/${imagename}"
sali getimage --host $1 --image $2 --exclude /etc/sali/exclude/${imagename}

echo "sali rsync"
sali rsync
