forked from WebThingsIO/zwave-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zwave-loader.sh
executable file
·36 lines (32 loc) · 1.02 KB
/
zwave-loader.sh
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
#!/bin/sh
#
# Script for setting LD_LIBRARY_PATH prior to launching the
# the zwave adapter.
NODE_CMD="$1"
ADDON_LOADER="$2"
ZWAVE_ADAPTER_DIR="$3"
OPENZWAVE_LIB_DIR="${ZWAVE_ADAPTER_DIR}/openzwave/lib"
if [ -d "${OPENZWAVE_LIB_DIR}" ]; then
if [ "$(uname)" = "Darwin" ]; then
if [ -z "${DYLD_LIBRARY_PATH}" ]; then
DYLD_LIBRARY_PATH="${OPENZWAVE_LIB_DIR}"
else
DYLD_LIBRARY_PATH="${OPENZWAVE_LIB_DIR}:${DYLD_LIBRARY_PATH}"
fi
export DYLD_LIBRARY_PATH
else
if [ -z "${LD_LIBRARY_PATH}" ]; then
LD_LIBRARY_PATH="${OPENZWAVE_LIB_DIR}"
else
LD_LIBRARY_PATH="${OPENZWAVE_LIB_DIR}:${LD_LIBRARY_PATH}"
fi
export LD_LIBRARY_PATH
fi
fi
OPENZWAVE_CONFIG_DIR="${ZWAVE_ADAPTER_DIR}/openzwave/config"
OPENZWAVE_ORIG_CONFIG_DIR="${ZWAVE_ADAPTER_DIR}/openzwave/config.orig"
if [ ! -d "${OPENZWAVE_CONFIG_DIR}" ]; then
cp -r "${OPENZWAVE_ORIG_CONFIG_DIR}" "${OPENZWAVE_CONFIG_DIR}"
fi
# Using exec replaces the current process with node
exec ${NODE_CMD} ${ADDON_LOADER} ${ZWAVE_ADAPTER_DIR}