#!/bin/bash

usage() {
echo -e "Usage: qcg-info-site-config [OPTION]\n \
  -s <site-ID> set site-ID to the specified string\n \
  -d display current site config file\n \
  -h print this help and exit"
}

CONF_FILE=/etc/qcg/bdii/site/qcg-info-site.conf

[[ -z $1 ]] && usage && exit 1
[[ x$1 == x-h ]] && usage && exit 0

if [[ x$1 == x-d ]]
then
        [[ ! -f $CONF_FILE ]] && echo "Config file not found" && exit 1
        cat $CONF_FILE
        exit 0;
fi

if [[ x$1 == x-s ]]
then
        [[ -z $2 ]] && usage && exit 1
        echo QCG_SITE_ID=$2 > $CONF_FILE
        exit 0;
fi

usage
exit 1
