#!/bin/sh

BACKUPFILE="/conf/dhcpleases.tgz"
BACKUPDIR="/var/dhcpd/var/db"

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