#!/bin/bash
# Backup NGCP YML configs and templates

set -e

if [ -z "${BACKUP}" ] ; then
  echo "ERROR: Missing mandatory environment variable '\$BACKUP', cannot continue!" >&2
  exit 1
fi

mkdir -p "${BACKUP}"
chown root:root "${BACKUP}"
chmod 0700 "${BACKUP}"

# backup config and templates
cp -a /etc/ngcp-config "${BACKUP}"
chmod 700 "${BACKUP}/ngcp-config"
