#! /bin/sh
#----------------------------------------------------------------------------
# template-backup-config - backup config file to /etc/backup.d
#
# Copyright (c) 2001-2003 Ansgar Püster <Ansgar.Puester@T-Online.de>
#
# Creation:	24.12.2003  ap
# Last Update:  $Id$
#
# This program 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 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------

# include eislib
. /var/install/include/eislib

header()
{
    clrhome
    mecho -info "Backup configuration file from $configd to $backupd"
    mecho
}

footer()
{
    mecho
    mecho
    anykey
}

# include function library
. /var/install/bin/config_shlib

#----------------------------------------------------------------------------

# get package name from filename PACKAGE-backup-config
filename=`basename $0`
package=`echo $filename | sed "s|-backup-config$||"`

# if package is template
#    take package from $PACKAGE
[ "$package" = 'template' ] && package="$PACKAGE"

#debug echo "+++ TEST filename: $filename"
#debug echo "         PACKAGE:  $PACKAGE"
#debug echo "         package:  $package"
#debug read answ < /dev/tty

header

if [ ! -f  $configd/$package ]; then
    mecho -error "Error: Configuration file $configd/$package does not exist"
else
    backup_config $package $configd/$package
fi

footer