diff options
Diffstat (limited to 'scripts/rvi_devrun')
-rwxr-xr-x | scripts/rvi_devrun | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/scripts/rvi_devrun b/scripts/rvi_devrun new file mode 100755 index 0000000..19842a2 --- /dev/null +++ b/scripts/rvi_devrun @@ -0,0 +1,98 @@ +#!/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/ +# + +# +# Launch an RVI node using the build directories +# For now this is a simple wrapper around the installer + +SELF_DIR=$(dirname $(readlink -f "$0")) +PRIV_DIR=$(dirname ${SELF_DIR})/priv +TARGET_DIR="" +ROOT_CERT="${PRIV_DIR}/certificates/insecure_root_cert.crt" +DEVICE_CERT="${PRIV_DIR}/certificates/insecure_device_cert.crt" +DEVICE_KEY="${PRIV_DIR}/keys/insecure_device_key.pem" +DEVICE_CRED="${PRIV_DIR}/credentials/insecure_credential.jwt" + +usage() { + cat <<EOF +Usage: +$0 [-r root_cert] [-d device_cert] [-c credentials] config_file + +Run a developer version of RVI + +-r root_cert - The certificate to validate received X509 device + certificates and credentials. + Default ${ROOT_CERT} + +-k device_key - The PEM file containing the device key pair used + to sign traff + Default ${DEVICE_KEY} + +-d device_cert - Certificate to use when authenticating self toward + remote nodes. + Default ${DEVICE_CERT} + +-c credentials - Credentials to present to remote nodes. Can be specified + multiple times + Default ${DEVICE_CRED} + +EOF +} + +while getopts "r:d:c:k:" o; do + case "${o}" in + r) + ROOT_CERT=${OPTARG} + ;; + + d) + DEVICE_CERT=${OPTARG} + ;; + + c) + DEVICE_CRED=${OPTARG} + ;; + + k) + DEVICE_KEY=${OPTARG} + ;; + *) + usage + ;; + esac +done + +shift $((${OPTIND}-1)) + +# Check that we have a target dir + +if [ "${#}" != "1" ] +then + echo "ERROR: Wrong number of arguments. Only specify config file" + usage +fi + +CONFIG_FILE=${1} + +./scripts/rvi_install \ + -k ${DEVICE_KEY} \ + -r ${ROOT_CERT} \ + -d ${DEVICE_CERT} \ + -c ${DEVICE_CRED} \ + /tmp/rvi_dev/rvi_core > /tmp/dev_install.log + +if [ "${?}" != "0" ] +then + echo "ERROR: Devevelop install failed:" + cat /tmp/dev_install.log + exit 255 +fi + +/tmp/rvi_dev/rvi_core/rvi_ctl -c ${CONFIG_FILE} console + |