#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (C) 2006-2019 British Crown (Met Office) & Contributors.
#
# This file is part of FCM, tools for managing and building source code.
#
# FCM 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
# (at your option) any later version.
#
# FCM 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 FCM. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Wrapper for "fcm":
# * Should be installed at a location like "/usr/bin".
# * Modify the default value for FCM_HOME_ROOT to suit your site.
#-------------------------------------------------------------------------------
if [[ -z ${FCM_HOME:-} ]]; then
    FCM_HOME_ROOT=${FCM_HOME_ROOT:-/opt}
    FCM_HOME=$FCM_HOME_ROOT/fcm
    if [[ -n ${FCM_VERSION:-} && -d $FCM_HOME_ROOT/fcm-$FCM_VERSION ]]; then
        FCM_HOME=$FCM_HOME_ROOT/fcm-$FCM_VERSION
    fi
fi
exec $FCM_HOME/bin/$(basename $0) "$@"
