1 | #!/bin/bash
|
2 | #
|
3 | # Copyright JS Foundation and other contributors, http://js.foundation
|
4 | #
|
5 | # Licensed under the Apache License, Version 2.0 (the "License");
|
6 | # you may not use this file except in compliance with the License.
|
7 | # You may obtain a copy of the License at
|
8 | #
|
9 | # http://www.apache.org/licenses/LICENSE-2.0
|
10 | #
|
11 | # Unless required by applicable law or agreed to in writing, software
|
12 | # distributed under the License is distributed on an "AS IS" BASIS,
|
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 | # See the License for the specific language governing permissions and
|
15 | # limitations under the License.
|
16 | #
|
17 |
|
18 | # Separate out node/v8 options from node-red ones
|
19 | OPTIONS=""
|
20 | ARGS=""
|
21 |
|
22 | for arg in "$@"
|
23 | do
|
24 | case $arg in
|
25 | --userDir|--settings|--help) ARGS="$ARGS $arg";;
|
26 | --*) OPTIONS="$OPTIONS $arg";;
|
27 | *) ARGS="$ARGS $arg";;
|
28 | esac
|
29 | done
|
30 |
|
31 | # Find the real location of this script
|
32 | CURRENT_PATH=`pwd`
|
33 | SCRIPT_PATH="${BASH_SOURCE[0]}";
|
34 | while [ -h "${SCRIPT_PATH}" ]; do
|
35 | cd "`dirname "${SCRIPT_PATH}"`"
|
36 | SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
|
37 | done
|
38 | cd "`dirname "${SCRIPT_PATH}"`" > /dev/null
|
39 | SCRIPT_PATH="`pwd`";
|
40 | cd $CURRENT_PATH
|
41 |
|
42 | # Run Node-RED
|
43 | exec /usr/bin/env node $OPTIONS $SCRIPT_PATH/../red.js $ARGS
|