2015-12-09 15:40:38 +01:00
|
|
|
#!/bin/bash
|
2016-06-08 23:21:42 +02:00
|
|
|
# Wrapper to start tool of the VILLASnode suite
|
2015-12-09 15:40:38 +01:00
|
|
|
#
|
2016-06-08 23:21:42 +02:00
|
|
|
# This allows you to use VILLASnode tools like this:
|
|
|
|
# $ villas node /etc/villas/test.cfg
|
2015-12-09 15:40:38 +01:00
|
|
|
#
|
|
|
|
# Install by:
|
|
|
|
# $ make install
|
|
|
|
#
|
|
|
|
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
2017-04-27 13:08:17 +02:00
|
|
|
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
|
|
|
|
# @license GNU General Public License (version 3)
|
|
|
|
#
|
|
|
|
# VILLASnode
|
|
|
|
#
|
|
|
|
# This program 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
|
|
|
|
# any later version.
|
2017-05-05 19:24:16 +00:00
|
|
|
#
|
2017-04-27 13:08:17 +02:00
|
|
|
# This program 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.
|
2017-05-05 19:24:16 +00:00
|
|
|
#
|
2017-04-27 13:08:17 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-11-22 11:14:25 -05:00
|
|
|
###################################################################################
|
2015-12-09 15:40:38 +01:00
|
|
|
|
2016-06-08 23:21:42 +02:00
|
|
|
PREFIX=villas
|
2015-12-09 15:40:38 +01:00
|
|
|
|
|
|
|
# Get a list of all available tools
|
2017-03-29 04:04:20 +02:00
|
|
|
TOOLS=$(compgen -c | egrep "^$PREFIX-" | sort -u | cut -d- -f2- | paste -sd'|')
|
2015-12-09 15:40:38 +01:00
|
|
|
|
|
|
|
# First argument to wrapper is the tool which should be started
|
|
|
|
TOOL=$1
|
|
|
|
|
|
|
|
# Following arguments will be passed directly to tool
|
|
|
|
ARGS=${@:2}
|
|
|
|
|
|
|
|
# Check if tool is available
|
|
|
|
if ! [[ "$TOOL" =~ $(echo ^\($TOOLS\)$) ]]; then
|
2017-03-29 04:04:20 +02:00
|
|
|
echo "Usage: villas [TOOL]" 1>&2
|
|
|
|
echo " TOOL is one of ${TOOLS}"
|
2017-05-05 19:24:16 +00:00
|
|
|
echo
|
2017-03-29 04:04:20 +02:00
|
|
|
echo "For detailed documentation, please run 'villas node'"
|
|
|
|
echo " and point your web browser to http://localhost:80"
|
|
|
|
echo
|
|
|
|
# Show VILLASnode copyright and contact info
|
2017-09-16 23:31:47 +02:00
|
|
|
villas-node -h | tail -n3
|
2015-12-09 15:40:38 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-24 19:33:35 +02:00
|
|
|
exec $PREFIX-$TOOL $ARGS
|