#!/bin/sh
#
# This file is part of OpenMediaVault.
#
# @license   http://www.gnu.org/licenses/gpl.html GPL Version 3
# @author    Volker Theile <volker.theile@openmediavault.org>
# @copyright Copyright (c) 2009-2017 Volker Theile
#
# OpenMediaVault is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# OpenMediaVault is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.

# Documentation/Howto:
# http://netatalk.sourceforge.net/wiki/index.php/Install_Netatalk_3.1.9_on_Debian_8_Jessie
# https://kofler.info/netatalk-3-konfiguration-fuer-time-machine-backups/
# http://www.rootathome.de/installation-von-netatalk-unter-debian/
# https://samuelhewitt.com/blog/2015-09-12-debian-linux-server-mac-os-time-machine-backups-how-to
# http://www.tuksub.de/2015/04/homeserver-31-time-machine-funktionalitaet-unter-debian-8-wiederherstellen/
# https://daniel-lange.com/archives/102-Apple-Timemachine-backups-on-Debian-8-Jessie.html

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

OMV_MKCONF_SCRIPTS_DIR=${OMV_MKCONF_SCRIPTS_DIR:-"/usr/share/openmediavault/mkconf"}

OMV_NETATALK_EXTENSIONS_DIR=${OMV_NETATALK_EXTENSIONS_DIR:-"${OMV_MKCONF_SCRIPTS_DIR}/netatalk.d"}
OMV_NETATALK_AFP_CONFIG=${OMV_NETATALK_AFP_CONFIG:-"/etc/netatalk/afp.conf"}

# Add additional extensions to the configuration file
cat /dev/null > ${OMV_NETATALK_AFP_CONFIG}
run-parts --exit-on-error ${OMV_NETATALK_EXTENSIONS_DIR}
