summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--priv/certificates/insecure_device_cert.crt (renamed from priv/sample_certificates/insecure_device_cert.crt)0
-rw-r--r--priv/certificates/insecure_root_cert.crt (renamed from priv/sample_certificates/insecure_root_cert.crt)0
-rw-r--r--priv/config/rvi_common.config8
-rw-r--r--priv/config/rvi_sample.config4
-rw-r--r--priv/credentials/insecure_credential.json (renamed from priv/sample_credentials/insecure_credential.json)0
-rw-r--r--priv/credentials/insecure_credential.jwt (renamed from priv/sample_credentials/insecure_credential.jwt)0
-rw-r--r--priv/keys/insecure_device_key.pem (renamed from priv/sample_keys/insecure_device_key.pem)0
-rw-r--r--priv/keys/insecure_root_key.pem (renamed from priv/sample_keys/insecure_root_key.pem)0
-rwxr-xr-xscripts/rvi_install151
-rwxr-xr-xscripts/rvi_install.sh88
11 files changed, 159 insertions, 99 deletions
diff --git a/Makefile b/Makefile
index e050e4b..e06ddb9 100644
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,6 @@ rpm: rpmclean rpm_tarball
rpmbuild --define "_topdir $$PWD/rpm" -ba rpm/SPECS/rvi-$(VERSION).spec
install: deps compile
- ./scripts/rvi_install.sh $(DESTDIR)/opt/rvi
- install --mode=0755 -d $(DESTDIR)/etc/opt/rvi/
- install --mode=0644 priv/config/rvi_sample.config $(DESTDIR)/etc/opt/rvi/rvi_sample.config
- install --mode=0644 priv/config/rvi_common.config $(DESTDIR)/opt/rvi/rvi_core/rvi_common.config
+ ./scripts/rvi_install.sh $(DESTDIR)/opt/rvi_core $(DESTDIR)/opt/rvi_core $(DESTDIR)/var/opt/log/rvi
+ install -m 0755 -d $(DESTDIR)/etc/opt/rvi/
+ install -m 0644 priv/config/rvi_sample.config $(DESTDIR)/etc/opt/rvi/rvi_sample.config
diff --git a/priv/sample_certificates/insecure_device_cert.crt b/priv/certificates/insecure_device_cert.crt
index efecf2a..efecf2a 100644
--- a/priv/sample_certificates/insecure_device_cert.crt
+++ b/priv/certificates/insecure_device_cert.crt
diff --git a/priv/sample_certificates/insecure_root_cert.crt b/priv/certificates/insecure_root_cert.crt
index 0f7b921..0f7b921 100644
--- a/priv/sample_certificates/insecure_root_cert.crt
+++ b/priv/certificates/insecure_root_cert.crt
diff --git a/priv/config/rvi_common.config b/priv/config/rvi_common.config
index 87563e7..d123c1c 100644
--- a/priv/config/rvi_common.config
+++ b/priv/config/rvi_common.config
@@ -115,10 +115,10 @@ LogLevel = Env("RVI_LOGLEVEL", info).
%% },
{rvi_core,
[
- {device_key, "$PRIV_DIR/sample_keys/insecure_device_key.pem"},
- {device_cert, "$PRIV_DIR/sample_certificates/insecure_device_cert.crt"},
- {root_cert, "$PRIV_DIR/sample_certificates/insecure_root_cert.crt"},
- {cred_dir, "$PRIV_DIR/sample_credentials"}
+ {device_key, "$PRIV_DIR/keys/insecure_device_key.pem"},
+ {device_cert, "$PRIV_DIR/x509_certificates/insecure_device_cert.crt"},
+ {root_cert, "$PRIV_DIR/x509_certificates/insecure_root_cert.crt"},
+ {cred_dir, "$PRIV_DIR/credentials"}
]}
]}
].
diff --git a/priv/config/rvi_sample.config b/priv/config/rvi_sample.config
index 57ffd37..a178c2d 100644
--- a/priv/config/rvi_sample.config
+++ b/priv/config/rvi_sample.config
@@ -8,8 +8,6 @@
%%
%% Configuration file for the (in-vehicle) IVI used by the hvac_demo
%%
-%% See ../hvac_demo/README.md for details on the demo.
-%%
%% See ../CONFIGURE.md for a details on the configuration process
%% itself.
%%
@@ -195,7 +193,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice).
%% to the targeted service. If a pair reports a failure, the next pair is tried.
[
{ proto_json_rpc, { dlink_tcp_rpc,
- % {"38.129.64.13", 8807}
+ %% {"38.129.64.13", 8807}
[ { target, IPPort(BackendIP, BackendPort) } ]}}
]
},
diff --git a/priv/sample_credentials/insecure_credential.json b/priv/credentials/insecure_credential.json
index 5788a06..5788a06 100644
--- a/priv/sample_credentials/insecure_credential.json
+++ b/priv/credentials/insecure_credential.json
diff --git a/priv/sample_credentials/insecure_credential.jwt b/priv/credentials/insecure_credential.jwt
index 0ce62ab..0ce62ab 100644
--- a/priv/sample_credentials/insecure_credential.jwt
+++ b/priv/credentials/insecure_credential.jwt
diff --git a/priv/sample_keys/insecure_device_key.pem b/priv/keys/insecure_device_key.pem
index 404af0a..404af0a 100644
--- a/priv/sample_keys/insecure_device_key.pem
+++ b/priv/keys/insecure_device_key.pem
diff --git a/priv/sample_keys/insecure_root_key.pem b/priv/keys/insecure_root_key.pem
index b9e2e3f..b9e2e3f 100644
--- a/priv/sample_keys/insecure_root_key.pem
+++ b/priv/keys/insecure_root_key.pem
diff --git a/scripts/rvi_install b/scripts/rvi_install
new file mode 100755
index 0000000..f1148fd
--- /dev/null
+++ b/scripts/rvi_install
@@ -0,0 +1,151 @@
+#!/bin/sh
+#
+# Copyright (C) 2014, Jaguar Land Rover
+#
+# This program is licensed under the terms and conditions of the
+# Mozilla Public License, version 2.0. The full text of the
+# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
+#
+
+#
+# Setup an RVI release
+#
+#
+
+SELF_DIR=$(dirname $(readlink -f "$0"))
+SETUP_GEN=$SELF_DIR/setup_gen # Ulf's kitchen sink setup utility
+
+usage() {
+ echo "Usage: $0 -r root_pub_key [-d device_key_pair] [-l log_dir ] [-s prefix_strip] target_dir"
+ echo
+ echo "Install a built RVI system into a target directory"
+ echo
+ echo "NOTE: The last component of 'taget_dir' must be named 'rvi_core'"
+ echo " Example: /opt/rvi_core"
+ echo
+ echo "-l log_dir - Log directory. Default: ${target_dir}/log."
+ echo "-s prefix_strip - See below. Default: nil."
+ echo "-r root_pub_key - Public root key to use. See below."
+ echo
+ echo "The created node can be started with: 'target'/rvi_ctl"
+ echo "The RVI installation will rely on a separate erlang install"
+ echo "to run."
+ echo
+ echo "PREFIX STRIPPING"
+
+ echo " If '-s prefix_strip' is provided, that part of the directories above"
+ echo " will be stripped of the given prefix in all internlal references."
+ echo " This is useful in debian and other build systems."
+ echo
+ echo " If, for example, 'target_dir' is './build/root/usr/bin', and"
+ echo " 'prefix_strip' is './build/root', all internal references"
+ echo " in the files installed under './build/root/usr/bin' will"
+ echo " reference '/usr/bin'."
+ echo
+ echo "ROOT KEY"
+ echo " The root key is used to validate remote certificates."
+ echo "
+ exit 1
+}
+
+TARGET_DIR=""
+LIB_DIR=""
+LOG_DIR=""
+
+while getopts "s:l:" o; do
+ case "${o}" in
+
+ l)
+ LOG_DIR=${OPTARG}
+ ;;
+
+ s)
+ PREFIX_STRIP=${OPTARG}
+ ;;
+
+ *)
+ usage
+ ;;
+ esac
+done
+
+shift $((${OPTIND}-1))
+
+if [ "${#}" = "0" ]
+then
+ echo "ERROR: Missing 'target_dir'."
+ echo
+ usage
+fi
+
+if [ "${#}" != "1" ]
+then
+ echo "ERROR: Wrong number of arguments."
+ echo
+ usage
+fi
+
+TARGET_DIR=${1}
+
+if [ $(basename ${TARGET_DIR}) != "rvi_core" ]
+then
+ echo "ERROR: Last component of 'target_dir' must be named rvi_core."
+ echo " Example: $(dirname ${TARGET_DIR})/rvi_core"
+ echo
+ exit 255
+fi
+
+# For now LIB_DIR is always same as TARGET_DIR
+LIB_DIR=${TARGET_DIR}
+
+if [ -z "${LOG_DIR}" ]
+then
+ LOG_DIR=${TARGET_DIR}/log
+fi
+
+rm -rf ${LIB_DIR} ${TARGET_DIR} > /dev/null 2>&1
+
+install -m 0755 -d ${TARGET_DIR}
+install -m 0755 -d ${LIB_DIR}
+install -m 0755 -d ${LOG_DIR}
+
+FILE_SET=$(find ebin components deps -name ebin -o -name priv)
+
+tar cf - ${FILE_SET} | (cd ${LIB_DIR} ; tar xf - )
+
+# Patch up the rvi with the correct directories.
+if [ -s "${PREFIX_STRIP}" ]
+then
+ STRIP_TARGET_DIR=$(echo ${TARGET_DIR} | sed "s|^${PREFIX_STRIP}||")
+ STRIP_LIB_DIR=$(echo ${LIB_DIR} | sed "s|^${PREFIX_STRIP}||")
+ STRIP_LOG_DIR=$(echo ${LOG_DIR} | sed "s|^${PREFIX_STRIP}||")
+else
+ STRIP_TARGET_DIR=${TARGET_DIR}
+ STRIP_LIB_DIR=${LIB_DIR}
+ STRIP_LOG_DIR=${LOG_DIR}
+fi
+
+sed -e "s|__RVI_LIBDIR__|${STRIP_LIB_DIR}|g" \
+ -e "s|__RVI_BINDIR__|${STRIP_TARGET_DIR}|g" \
+ -e "s|__RVI_LOGDIR__|${STRIP_LOG_DIR}|g" < scripts/rvi_ctl > /tmp/rvi_ctl
+
+install -m 0755 /tmp/rvi_ctl ${TARGET_DIR}
+install -m 0755 scripts/setup_gen ${TARGET_DIR}
+install -m 0755 rel/files/nodetool ${TARGET_DIR}
+install -m 0755 python/rvi_service.py ${TARGET_DIR}/rvi_service
+install -m 0755 python/rvi_call.py ${TARGET_DIR}/rvi_call
+install -m 0644 python/rvilib.py ${TARGET_DIR}
+install -m 0755 python/rvi_get_services.py ${TARGET_DIR}/rvi_get_services
+install -m 0755 -D priv/config/rvi_common.config ${TARGET_DIR}/priv/config/rvi_common.config
+
+echo "RVI binary files installed under ${TARGET_DIR}"
+# echo "RVI library files installed under ${LIB_DIR}"
+echo "RVI will log to ${LOG_DIR}"
+echo
+echo "Start: ${TARGET_DIR}/rvi_ctl -c <config_file> start"
+echo "Attach started RVI: ${TARGET_DIR}/rvi_ctl attach"
+echo "Stop: ${TARGET_DIR}/rvi_ctl stop"
+echo "Start console mode: ${TARGET_DIR}/rvi_ctl -c <config_file> console"
+echo
+exit 0
+
diff --git a/scripts/rvi_install.sh b/scripts/rvi_install.sh
deleted file mode 100755
index 7e949a1..0000000
--- a/scripts/rvi_install.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2014, Jaguar Land Rover
-#
-# This program is licensed under the terms and conditions of the
-# Mozilla Public License, version 2.0. The full text of the
-# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
-#
-
-#
-# Setup an RVI release with a configuration file.
-#
-# This script will setup a directory with with the same name
-# as the release name. The script uses Ulf Wiger's setup application
-# (github.com/Feuerlabs/setup) to generate the release.
-#
-# With the -d argument, a developer release will be built with
-# only
-#
-# Once setup, the RVI node can be started with ./rvi_node <release_na,e?
-#
-# Please note that the generated release will depend on the built
-#
-# In order to create a standalone release, use create_rvi_release.sh
-#
-
-SELF_DIR=$(dirname $(readlink -f "$0"))
-SETUP_GEN=$SELF_DIR/setup_gen # Ulf's kitchen sink setup utility
-
-usage() {
- echo "Usage: $0 binary_dir"
- echo
- echo "RVI will be installed in 'target_dir'."
- echo
- echo "The created node can be started with: 'target_dir'/rvi.sh"
- echo "RVI in 'target_dir' will rely on a native erlang to function"
- exit 1
-}
-
-
-
-shift $((${OPTIND}-1))
-
-if [ "${#}" != "1" ]
-then
- echo "Target directory not specifiied."
- usage
-fi
-
-TARGET_DIR=$1
-
-#
-# Prepend abs path if TARGET_DIR is relative
-#
-if [ $(echo ${TARGET_DIR} | cut -c 1,1) != "/" ]
-then
- TARGET_DIR=${PWD}/${TARGET_DIR}
-fi
-
-
-cd ${SELF_DIR}/..;
-
-rm -rf ${TARGET_DIR} > /dev/null 2>&1
-
-install --mode=0755 -d ${TARGET_DIR}/rvi_core
-install --mode=0755 -d ${TARGET_DIR}/scripts
-
-FILE_SET=$(find priv ebin components deps -name ebin -o -name priv)
-
-echo "Installing rvi at ${TARGET_DIR}."
-
-tar cf - ${FILE_SET} | (cd ${TARGET_DIR}/rvi_core ; tar xf - )
-install --mode=0755 scripts/rvi.sh ${TARGET_DIR}
-install --mode=0755 scripts/setup_gen ${TARGET_DIR}/scripts
-install --mode=0755 rel/files/nodetool ${TARGET_DIR}/scripts
-install --mode=0755 scripts/rvi_create_root_key.sh ${TARGET_DIR}/scripts
-install --mode=0755 scripts/rvi_create_device_key.sh ${TARGET_DIR}/scripts
-install --mode=0755 scripts/rvi_create_certificate_key.sh ${TARGET_DIR}/scripts
-
-
-echo "RVI installed under ${TARGET_DIR}"
-echo "Start: ${TARGET_DIR}/rvi.sh -c <config_file> start"
-echo "Attach started RVI: ${TARGET_DIR}/rvi.sh attach"
-echo "Stop: ${TARGET_DIR}/rvi.sh stop"
-echo "Start console mode: ${TARGET_DIR}/rvi.sh -c <config_file> console"
-
-exit 0
-