UNPKG

1.27 kBPlain TextView Raw
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
19OPTIONS=""
20ARGS=""
21
22for arg in "$@"
23do
24 case $arg in
25 --userDir|--settings|--help) ARGS="$ARGS $arg";;
26 --*) OPTIONS="$OPTIONS $arg";;
27 *) ARGS="$ARGS $arg";;
28 esac
29done
30
31# Find the real location of this script
32CURRENT_PATH=`pwd`
33SCRIPT_PATH="${BASH_SOURCE[0]}";
34while [ -h "${SCRIPT_PATH}" ]; do
35 cd "`dirname "${SCRIPT_PATH}"`"
36 SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
37done
38cd "`dirname "${SCRIPT_PATH}"`" > /dev/null
39SCRIPT_PATH="`pwd`";
40cd $CURRENT_PATH
41
42# Run Node-RED
43exec /usr/bin/env node $OPTIONS $SCRIPT_PATH/../red.js $ARGS