/usr/bin/csg_call is in votca-csg 1.3.0-3+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | #!/bin/bash
#
# Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version='1.3 '
ext_cmd=""
simprog=""
log=""
show_share="no"
#unset stuff from enviorment
unset CSGXMLFILE CSGDEBUG bondtype bondname
#failback define
die() {
echo -e "$*" >&2
exit 1
}
show_help () {
cat << eof
==================================================
======== VOTCA (http://www.votca.org) ========
==================================================
please submit bugs to bugs@votca.org
${0##*/}, version ${version}
This script calls scripts and functions for the iterative framework.
Function can be executed or shows if key1='function'.
Usage: ${0##*/} [OPTIONS] key1 key2 [SCRIPT OPTIONS]
Allowed options:
-l, --list Show list of all script
--cat Show the content of the script
--show Show the path to the script
--show-share Shows the used VOTCASHARE dir and exits
--scriptdir DIR Set the user script dir
(Used if no options xml file is given)
Default: empty
--options FILE Specify the options xml file to use
--log FILE Specify the log file to use
Default: stdout
--ia-type type Specify the interaction type to use
--ia-name name Specify the interaction name to use
--nocolor Disable colors
--sloppy-tables Allow tables without flags
--debug Enable debug mode with a lot of information
-h, --help Show this help
Examples:
* ${0##*/} table smooth [ARGUMENTS]
* ${0##*/} --show run gromacs
eof
}
while [[ ${1#-} != $1 ]]; do
if [[ ${1#--} = $1 && -n ${1:2} ]]; then
#short opt with arguments here: fc
if [[ ${1#-[fc]} != ${1} ]]; then
set -- "${1:0:2}" "${1:2}" "${@:2}"
else
set -- "${1:0:2}" "-${1:2}" "${@:2}"
fi
fi
case $1 in
-l | --list)
ext_cmd="show_csg_tables"
shift ;;
--scriptdir)
die "'--scriptdir' is obsolete, please specify the script path in the xml file (cg.inverse.scriptpath)"
shift 2;;
--simprog)
die "'--simprog' is obsolete, please specify the simprog in the xml file (cg.inverse.program)"
shift 2;;
--options)
export CSGXMLFILE="$2"
[ -f "$CSGXMLFILE" ] || die "options xml file '$CSGXMLFILE' not found"
shift 2;;
--sloppy-tables)
export VOTCA_TABLES_WITHOUT_FLAG="yes"
shift ;;
--log)
log="$2"
shift 2;;
--ia-type)
export bondtype="$2"
shift 2;;
--ia-name)
export bondname="$2"
shift 2;;
--cat)
ext_cmd="cat_external"
shift;;
--show)
ext_cmd="source_wrapper"
shift;;
--show-share)
show_share="yes"
shift;;
--nocolor)
export CSGNOCOLOR="yes"
shift;;
-h | --help)
show_help
exit 0;;
--debug)
export CSGDEBUG="yes"
shift;;
-v | --version)
echo "${0##*/}, version $version"
exit 0;;
*)
die "Unknown option '$1'";;
esac
done
if [[ -z ${VOTCASHARE} ]]; then
if [ -f "${0%/*}/../share/votca/scripts/inverse/inverse.sh" ]; then
#transform it to a global path
export VOTCASHARE="$(cd ${0%/*}/../share/votca;pwd)"
elif [ -f "/usr/share/votca/scripts/inverse/inverse.sh" ]; then
export VOTCASHARE="/usr/share/votca"
else
echo "Error: Environment value VOTCASHARE is not defined and could not be guessed" >&2
echo "Export VOTCASHARE or source VOTCARC.bash or VOTCARC.csh" >&2
exit 1
fi
else
if [[ ! -f ${VOTCASHARE}/scripts/inverse/inverse.sh ]]; then
echo "Error: Environment value VOTCASHARE seems to be wrong" >&2
echo "Could not find \${VOTCASHARE}/scripts/inverse/inverse.sh" >&2
echo "Export VOTCASHARE or source VOTCARC.bash or VOTCARC.csh" >&2
exit 1
fi
fi
if [ "$show_share" = "yes" ]; then
echo "${VOTCASHARE}"
exit 0
fi
if [[ -f ${VOTCASHARE}/scripts/inverse/start_framework.sh ]]; then
source ${VOTCASHARE}/scripts/inverse/start_framework.sh || die "Could not source start_framework.sh"
else
die "Could not find start_framework.sh"
fi
[[ -n ${CSGXMLFILE} ]] && scriptpath="$(csg_get_property --allow-empty cg.inverse.scriptpath)" > /dev/null
[[ -n ${scriptpath} ]] && echo "Adding '$scriptpath to csgshare" && add_to_csgshare "$scriptpath"
[[ -n ${CSGXMLFILE} ]] && simprog="$(csg_get_property --allow-empty cg.inverse.program "$simprog")"
[[ -n ${simprog} ]] && echo "We are using Sim Program: $simprog" && source_function $simprog
if [[ $ext_cmd = show_csg_tables ]]; then
$ext_cmd
exit $?
fi
[[ -z $1 || -z $2 ]] && die "${0##*/}: Missing argument"
if [[ -n $ext_cmd ]]; then
$ext_cmd $1 $2
exit $?
fi
#help of scripts should always work and be quiet
if [[ $3 = --help ]]; then
cat <<EOF
==================================================
======== VOTCA (http://www.votca.org) ========
==================================================
please submit bugs to bugs@votca.org
EOF
scriptname=$(source_wrapper $1 $2)
do_external -q $1 $2 --help | sed -e "s/%version%/${version}/" -e "/^Usage/s@${scriptname##*/}@${0##*/} [OPTIONS] $1 $2@g"
exit $?
fi
[[ -n ${log} ]] && enable_logging "$log"
[[ -n $CSGDEBUG ]] && set -x
do_external $@
exit $?
|