#!/bin/sh

#This creates a backup tarball.

if test -a VERSION ; then
	VERSION="$(cat VERSION)"
	if test -a TARGET ; then
		TARGET="$(cat TARGET)"
#-------------------------------------------------------------
		echo "Backing up..."
		
		cd ../..
		tar czvf ${TARGET}-${VERSION}-$(date +%Y%m%d-%H%M%S)-backup.tar.gz ${TARGET} --exclude=*.gz --exclude=*.ipk --exclude=*.o --exclude=.* --exclude=*~ 
		
		echo "All done."
#-------------------------------------------------------------
	else
		echo "ERROR: File \"TARGET\" not found. This is a text file with the project name inside it."
	fi
else
	echo "ERROR: File \"VERSION\" not found. This is a text file with the version number inside it."
fi

