#! /bin/bash
# -*- mode: shell-script -*-

prog=$(basename $0)
usage="$prog <path-to-config-file> ..."

case $# in
    0)
        echo $usage
        exit 2
        ;;
    *)
        configfile=$1
        shift
        ;;
esac

# check that the config file exists
if [ ! -f $configfile ] ;then
    echo "$prog: $configfile file does not exist"
    exit 4
fi

# copy the configuration file(s) to the destination
# use the "real" config file to get the destination
idir=$(getconf.py --config $configfile install-dir pbench-agent)
dest=$idir/config
# FIXME - Why do we gratuitously copy any remaining
# command line parameters as well?
cp $configfile "$@" $dest/
exit $?
