rc.restore_full_backup 518 Bytes
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1 2 3
#!/bin/sh

echo -n "Checking..."
Franco Fichtner's avatar
Franco Fichtner committed
4
if [ `tar tzPf $1 /usr/local/etc/rc 2>/dev/null` ]; then
Ad Schellevis's avatar
Ad Schellevis committed
5 6 7
	echo " Backup file looks OK."
	echo "One moment, restoring ${1}..."
	if [ -f /tmp/do_not_restore_config.xml ]; then
8
		EXCLUDE="--exclude /conf/config.xml"
Ad Schellevis's avatar
Ad Schellevis committed
9 10
		rm /tmp/do_not_restore_config.xml
	else
11
		EXCLUDE=""
Ad Schellevis's avatar
Ad Schellevis committed
12 13 14 15 16 17 18 19
	fi
	tar xzPfU $1 $EXCLUDE -C / 2>/var/etc/restore_log.txt
	echo "Restore of $1 complete."
else
	echo " Error."
	echo "File not found or invalid backup file. Available backups:"
	ls -lah /root | grep backup | more
fi