diff options
author | Magnus Feuer <mfeuer@jaguarlandrover.com> | 2015-11-22 19:45:30 -0800 |
---|---|---|
committer | Magnus Feuer <mfeuer@jaguarlandrover.com> | 2015-11-22 19:45:30 -0800 |
commit | e79bcd3b8d6a116f38b97825874abf0b7167faf7 (patch) | |
tree | 18301f0d411b02057ed89a6775f5e0aa8e73b691 /scripts | |
parent | 7932e5903de9ddcb389e585b63e63a831ad1fd35 (diff) | |
download | rvi_core-e79bcd3b8d6a116f38b97825874abf0b7167faf7.tar.gz |
mfeuer-new_scripts: Merged and modified release-0.4.0-yocto_makefile
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rvi.sh | 33 | ||||
-rwxr-xr-x | scripts/rvi_create_certificate.py | 2 | ||||
-rwxr-xr-x | scripts/rvi_create_device_key.py | 2 | ||||
-rwxr-xr-x | scripts/setup_gen | bin | 71094 -> 71079 bytes |
4 files changed, 25 insertions, 12 deletions
diff --git a/scripts/rvi.sh b/scripts/rvi.sh index fe9cd01..eee8b5b 100755 --- a/scripts/rvi.sh +++ b/scripts/rvi.sh @@ -21,7 +21,7 @@ usage() { echo " start|stop|console|attach|ping" echo echo " -c config_file Configuration file to launch rvi node with. " - echo " If omitted the rvi.config in the configuration " + echo " If omitted the rvi_sample.config in the configuration " echo " directory will be used." echo echo " -s short_name Erlang node short name. Defaults to 'rvi_core'" @@ -36,15 +36,15 @@ usage() { echo " Defaults to '/tmp/rvi/[config]/log' where [config]" echo " is the base name of the configuration file." echo - echo " start Start an rvi node with the given configuration file." + echo " console [defaut] Start an rvi in foreground mode." + echo + echo " start Start an rvi node with the given configuration file." echo - echo " stop Stop an rvi node previously started with 'start'." + echo " stop Stop an rvi node previously started with 'start'." echo - echo " console Start an rvi in foreground mode." - echo - echo " attach Attach to an rvi node previously started with 'start'." + echo " attach Attach to an rvi node previously started with 'start'." echo - echo " ping Ping to check if an rvi node is up. Returns 0 if up." + echo " ping Ping to check if an rvi node is up. Returns 0 if up." exit 1 } @@ -80,15 +80,26 @@ done CONFIG_DIR=${CONFIG_DIR:=/etc/opt/rvi} shift $((${OPTIND}-1)) -CMD=$1 -if [ "${CMD}" != "start" -a "${CMD}" != "stop" -a "${CMD}" != "console" -a "${CMD}" != "ping" ] +if [ "${#}" = "0" ] +then + CMD="console" +else + CMD=$1 +fi + +if [ "${CMD}" != "start" -a "${CMD}" != "attach" -a "${CMD}" != "stop" -a "${CMD}" != "console" -a "${CMD}" != "ping" ] then usage fi export ERL_LIBS=${SELF_DIR}/rvi_core:${SELF_DIR}/rvi_core/deps:${SELF_DIR}/rvi_core/components +# Convert config dir to abs path +if [ $(echo ${CONFIG_DIR} | cut -c 1,1) != "/" ] +then + CONFIG_DIR=${PWD}/${CONFIG_DIR} +fi # Check that we have a config dir if [ ! -d ${CONFIG_DIR} ] @@ -109,7 +120,7 @@ fi if [ ${CMD} = "start" -o ${CMD} = "console" ] then # Default to rvi.config - CONFIG_FILE=${CONFIG_FILE:=${CONFIG_DIR}/rvi.config} + CONFIG_FILE=${CONFIG_FILE:=${CONFIG_DIR}/rvi_sample.config} # # Check if we need to prepend current dir # to relative config file path @@ -152,10 +163,12 @@ case "${CMD}" in start) install -d --mode 0755 ${TMP_DIR} install -d --mode 0755 ${LOG_DIR} + cd ${SELF_DIR} exec run_erl -daemon ${TMP_DIR}/ ${LOG_DIR} "exec ${LAUNCH}" ;; console) + cd ${SELF_DIR} exec ${LAUNCH} ;; diff --git a/scripts/rvi_create_certificate.py b/scripts/rvi_create_certificate.py index e4d5b0b..6e09fdc 100755 --- a/scripts/rvi_create_certificate.py +++ b/scripts/rvi_create_certificate.py @@ -239,7 +239,7 @@ encoded = jwt.encode(cert, root_key.exportKey("PEM"), algorithm='RS256') # Validate try: - jwt.decode(encoded, root_key.publickey().exportKey("PEM"), algorithm='RS256') + jwt.decode(encoded, root_key.publickey().exportKey("PEM")) except: print "FAILED: Could not verify signed JSON Web Token using public part of" print " root key {}".format(root_key_fname) diff --git a/scripts/rvi_create_device_key.py b/scripts/rvi_create_device_key.py index 59f671e..060ea8b 100755 --- a/scripts/rvi_create_device_key.py +++ b/scripts/rvi_create_device_key.py @@ -124,7 +124,7 @@ signature = jwt.encode(key_obj, priv_root_key.exportKey('PEM'), algorithm='RS256 pub_root_key = priv_root_key.publickey().exportKey('PEM') try: - jwt.decode(signature, pub_root_key, algorithm='RS256') + jwt.decode(signature, pub_root_key) except: print "FAILED VERIFICATION!" print "The public portion of the generated device key, signed by the provided private root key," diff --git a/scripts/setup_gen b/scripts/setup_gen Binary files differindex 999d38e..1d90585 100755 --- a/scripts/setup_gen +++ b/scripts/setup_gen |