# # $Id: frontend.in,v 1.53 2004/03/24 18:36:01 jmmv Exp $ # bt_config's frontend. # # buildtool # Copyright (c) 2002, 2003, 2004 Julio M. Merino Vidal. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. Neither the name of the author nor the names of contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # usage() { local exitstat=$1 cat 1>&2 <&2 bt_dir_list echo 1>&2 echo "Features supported by this package (names are case insensitive):" \ 1>&2 bt_feature_list echo 1>&2 echo "See buildtool(1) for more information." 1>&2 exit ${exitstat} } main() { local argsorig counter load_sw_config btcmn_req_runtime btcmn_req_project if [ $(pwd) != ${BT_TOPDIR} ]; then btcmn_warn "pwd changed to ${BT_TOPDIR}" cd ${BT_TOPDIR} fi argsorig= load_sw_config=yes while [ $# -gt 0 ]; do echo $1 | grep ^- >/dev/null || break case $1 in --ignore-sw-config) load_sw_config=no ;; *) argsorig+=$1 ;; esac shift done set -- ${argsorig} "$@" # Load bt_config base module . "@DIR_SHARE@/bt_config/base.subr" # Load system configuration if [ ${load_sw_config} = yes -a -f "@DIR_CONF@/bt_config.conf" ]; then echo "bt_config: loading system-wide configuration" . "@DIR_CONF@/bt_config.conf" fi btcmn_req_config bt_argsinit config_init while [ $# -gt 0 ]; do echo $1 | grep '^-' >/dev/null || break case $1 in -d) bt_dir_parse "$2" shift ;; --dir-*) bt_dir_parse "`echo $1 | sed -e s/--dir-//`" ;; --disable-*) bt_feature_parse "`echo $1 | sed -e s/--disable-//`=no" ;; --enable-*) bt_feature_parse "`echo $1 | sed -e s/--enable-//`=yes" ;; -f) bt_feature_parse "$2" shift ;; --feature-*) bt_feature_parse "`echo $1 | sed -e s/--feature-//`" ;; -h|--help) usage 0 ;; -H) btcmn_err "\`-H' is deprecated, use \`-h' alone" ;; -p) BT_PREFIX="$2" shift ;; --prefix=*) BT_PREFIX="`echo $1 | sed -e 's/--prefix=//'`" ;; -w) BT_WORKDIR="$2" shift ;; --workdir=*) BT_WORKDIR="`echo $1 | sed -e 's/--workdir=//'`" ;; --) shift; break ;; *) btcmn_warn "ignoring unknown modifier \`$1'" ;; esac shift done echo ${BT_WORKDIR} | grep ^/ >/dev/null 2>&1 || \ btcmn_err "path to work directory must be absolute" # Parse the script bt_init config bt_finish echo echo "===========================================================================" # NOLINT echo "Configuration summary for ${BT_PKG_NAME}-${BT_PKG_VERSION}:" echo counter=0 while [ ${counter} -lt ${bt_msg_summary_count} ]; do eval eval echo \""' '"\${bt_msg_summary_${counter}}""\" counter=$((${counter} + 1)) done echo echo "===========================================================================" # NOLINT echo return 0 } # Local Variables: *** # mode: shell-script *** # End: *** # vim: syntax=sh