#!/bin/sh

# DATE=$(date +%Y-%m-%d_%H-%M-%S)
DATE=$(date +%Y-%m-%d_%H-%M)
USRF="/var/tuxbox/config/tobackup.conf"

if [ -e "${USRF}" ]; then
# read user-files from $USRF
	TOBACKUP="${USRF}"
	while read i
		do [ "${i:0:1}" = "#" ] || TOBACKUP="$TOBACKUP ${i%%#*}"
		done < $USRF

else
	TOBACKUP="/var/tuxbox/config/"
fi

# check existence
RES=""
for i in $TOBACKUP
	do [ -e "$i" ] && RES="$RES $i"
	done

TOBACKUP=$(echo $RES)

echo Backup to $1/Zee2_S_$DATE.tar

# tar -cf $1/Zee2_S_$DATE.tar $TOBACKUP 2>&1 >/dev/null
# tar -cf $1/Zee2_C_$DATE.tar $TOBACKUP 2>&1 >/dev/null
tar -cf $1/Trinity_S_$DATE.tar $TOBACKUP 2>&1 >/dev/null
# tar -cf $1/Trinity_C_$DATE.tar $TOBACKUP 2>&1 >/dev/null
# tar -cf $1/Tank_S_$DATE.tar $TOBACKUP 2>&1 >/dev/null
# tar -cf $1/Tank_S_C_$DATE.tar $TOBACKUP 2>&1 >/dev/null
# tar -cf $1/NeoMini_S_$DATE.tar $TOBACKUP 2>&1 >/dev/null
# tar -cf $1/NeoMini_C_$DATE.tar $TOBACKUP 2>&1 >/dev/null

if [ -e /bin/msgbox ]
then
	msgbox popup="Een backup van uw instellingen is gemaakt." --timeout=10 --title="Backup Succesvol" > /dev/null
fi 


