#!/bin/sh

BACKUPDIR="/var/db/rrd"
BACKUPFILE="/conf/rrd.tgz"

if [ "${1}" = "restore" ]; then
	if [ -f "${BACKUPFILE}" ]; then
		tar -C / -xzpf "${BACKUPFILE}"
	fi
else
	if [ -d "${BACKUPDIR}" ]; then
		tar -C / -czf "${BACKUPFILE}" ."${BACKUPDIR}"
	fi
fi