#!/bin/sh
##############################################################################
#
#  Copyright (c) 2005, Doremi Labs, Inc.
#    All rights reserved.
#
#  Redistribution in source or binary forms, with or without
#  modification, are NOT permitted.
#
#    Doremi Labs, Inc.
#    1020 Chestnut St.
#    Burbank, CA 91506
#    Tel : (818) 562 1101
#    Fax : (818) 562 1109
#
##############################################################################

. $(dirname $0)/../common.sh

FILE_LIST="/doremi/opt
/doremi/etc"

PERM_LIST="
/doremi/etc[root:admin]
/doremi/etc/certs/mine[root:root]
/doremi/etc/certs/https[root:root]
/doremi/etc/shellinaboxd[www-data:www-data]
/doremi/etc/vnc/passwd[root:root]
/doremi/opt/[root:admin]
/doremi/opt/https[root:root]"

EXCLUDE_FILE_LIST="/doremi/opt/backup
/doremi/etc/certs/mine
/doremi/etc/maintenance.default"

do_backup ()
{
  safe_backup $FILE_LIST
  safe_delete $EXCLUDE_FILE_LIST
}

do_restore ()
{
  safe_delete $EXCLUDE_FILE_LIST
  safe_restore $FILE_LIST
}

case "$1" in
  backup)
    do_backup
    ;;
    
  restore)
    do_restore
    ;;
    
  *)
    echo "Usage: $0 [backup] [restore]"
    exit -1
    ;;
esac

exit 0
