From 952cf90564e7792c3d39e4520eef955eb23640a8 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Wed, 18 Nov 2015 15:10:38 -0800 Subject: Now handles rvi releases named 'rvi' --- scripts/setup_rvi_node.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/setup_rvi_node.sh b/scripts/setup_rvi_node.sh index a14a54f..5dfe55f 100755 --- a/scripts/setup_rvi_node.sh +++ b/scripts/setup_rvi_node.sh @@ -108,7 +108,10 @@ else cp $NODE_NAME/sys.config rel/files/sys.config ./rebar generate # Rename the release after the node name - mv rel/rvi rel/$NODE_NAME + if [ ${NODE_NAME} != "rvi" ] + then + mv rel/rvi rel/$NODE_NAME + fi echo "Stand alone release for $NODE_NAME created under project " echo "root directory's ./rel/$NODE_NAME." echo -- cgit v1.2.1 From 227e90e0048fcc51517e2d585970f4acf9f3c273 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Wed, 18 Nov 2015 15:14:10 -0800 Subject: Added missing files. --- scripts/start_rvi.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 scripts/start_rvi.sh (limited to 'scripts') diff --git a/scripts/start_rvi.sh b/scripts/start_rvi.sh new file mode 100644 index 0000000..6683c52 --- /dev/null +++ b/scripts/start_rvi.sh @@ -0,0 +1,71 @@ +#!/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 a correct configuration and launch an RVI release node. +# If a UUID file has not been created, it will be done at this time. +# + +SELF_DIR=$(dirname $(readlink -f "$0")) +CONFIG_DIR=/etc/opt/rvi +BIN_DIR=/opt/rvi + +usage() { + echo "Usage: $0 -c config_file" + echo " -c config_file Specify the configuration " + echo "Configuration data is read from the configuration file." + exit 1 +} + +while getopts "c:" o; do + case "${o}" in + c) + CONFIG_FILE=${OPTARG} + ;; + *) + usage + ;; + esac +done + +if [ -z "${CONFIG_FILE}" ] ; then + echo "Missing -c flag" + usage +fi + +# Check if we have a uuid file. +if [ ! -f ${CONFIG_DIR}/device_id ] +then + echo "Creating device ID in ${CONFIG_DIR}/device_id" + cat /proc/sys/kernel/random/uuid > ${CONFIG_DIR}/device_id +fi + +# +# Generate a config file that will end up as +# /tmp/rvi/sys.config +# +( + cd /tmp/ + rm -rf rvi + export ERL_LIBS=${BIN_DIR}/setup:${BIN_DIR}/lib/ + ${BIN_DIR}/setup_gen rvi $CONFIG_FILE rvi +) + +# Did we succeed with config generation? +if [ "$?" != "0" ] +then + # Nope + exit "$?" +fi + +# Copy created config file to /etc/opt/rvi/sys.config, +# which is symlinked to by /opt/rvi/sys.config +cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config + +exec /opt/rvi/bin/rvi start -- cgit v1.2.1 From e59cc0af174952f6e598d99f36d7e3a9aaf1c7b8 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Wed, 18 Nov 2015 16:42:22 -0800 Subject: rvi_start.sh renamed rvi.sh. Now accepts start|stop|console. Can now be run from any directory --- scripts/rvi | 101 +++++++++++++++++++++++++++++------------------- scripts/rvi.sh | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/start_rvi.sh | 71 ---------------------------------- 3 files changed, 169 insertions(+), 110 deletions(-) mode change 100755 => 100644 scripts/rvi create mode 100644 scripts/rvi.sh delete mode 100644 scripts/start_rvi.sh (limited to 'scripts') diff --git a/scripts/rvi b/scripts/rvi old mode 100755 new mode 100644 index 337432e..6683c52 --- a/scripts/rvi +++ b/scripts/rvi @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # # Copyright (C) 2014, Jaguar Land Rover # @@ -6,43 +6,66 @@ # Mozilla Public License, version 2.0. The full text of the # Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ # + # -# Init.d script to start and stop an RVI system installed -# through an RPM. +# Setup a correct configuration and launch an RVI release node. +# If a UUID file has not been created, it will be done at this time. # -export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" -. /lib/lsb/init-functions - -set -e - -case "$1" in - start) - log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" - if /opt/rvi-0.4.0/bin/rvi start; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" - if /opt/rvi-0.4.0/bin/rvi stop; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - restart) - log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" - if /opt/rvi-0.4.0/bin/rvi restart; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - *) - log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" - exit 1 -esac - -exit 0 + +SELF_DIR=$(dirname $(readlink -f "$0")) +CONFIG_DIR=/etc/opt/rvi +BIN_DIR=/opt/rvi + +usage() { + echo "Usage: $0 -c config_file" + echo " -c config_file Specify the configuration " + echo "Configuration data is read from the configuration file." + exit 1 +} + +while getopts "c:" o; do + case "${o}" in + c) + CONFIG_FILE=${OPTARG} + ;; + *) + usage + ;; + esac +done + +if [ -z "${CONFIG_FILE}" ] ; then + echo "Missing -c flag" + usage +fi + +# Check if we have a uuid file. +if [ ! -f ${CONFIG_DIR}/device_id ] +then + echo "Creating device ID in ${CONFIG_DIR}/device_id" + cat /proc/sys/kernel/random/uuid > ${CONFIG_DIR}/device_id +fi + +# +# Generate a config file that will end up as +# /tmp/rvi/sys.config +# +( + cd /tmp/ + rm -rf rvi + export ERL_LIBS=${BIN_DIR}/setup:${BIN_DIR}/lib/ + ${BIN_DIR}/setup_gen rvi $CONFIG_FILE rvi +) + +# Did we succeed with config generation? +if [ "$?" != "0" ] +then + # Nope + exit "$?" +fi + +# Copy created config file to /etc/opt/rvi/sys.config, +# which is symlinked to by /opt/rvi/sys.config +cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config + +exec /opt/rvi/bin/rvi start diff --git a/scripts/rvi.sh b/scripts/rvi.sh new file mode 100644 index 0000000..6e15d17 --- /dev/null +++ b/scripts/rvi.sh @@ -0,0 +1,107 @@ +#!/bin/sh +# +# Copyright (C) 2014, Jaguar Land Rover +# +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# +# Setup a correct configuration and launch an RVI release node. +# If a UUID file has not been created, it will be done at this time. +# Init.d script to start and stop an RVI system installed +# through an RPM. +# + +SELF_DIR=$(dirname $(readlink -f "$0")) +CONFIG_DIR=/etc/opt/rvi +RVI_DIR=/opt/rvi + +usage() { + echo "Usage: $0 [-c config_file] start|stop|console" + echo " -c config_file Configuration file. " + echo " Not used with start and console." + echo + echo " start Start an rvi node with the given" + echo " configuration file." + echo + echo " stop Stop an rvi node previously started" + echo " with start." + echo + echo " console Start an rvi in foreground mode." + exit 1 +} + +while getopts "c:" o; do + case "${o}" in + c) + CONFIG_FILE=${OPTARG} + ;; + *) + usage + ;; + esac +done + +shift $((${OPTIND}-1)) +CMD=$1 + +if [ "$CMD" != "start" -a "$CMD" != "stop" -a "$CMD" != "console" ] +then + usage +fi + +if [ "$CMD" = "stop" ] +then + ${RVI_DIR}/bin/rvi stop + exit $? +fi + +# Check if we need to prepend current dir +# to relative config file path +# + +if [ $(echo ${CONFIG_FILE} | cut -c 1,1) != "/" ] +then + CONFIG_FILE=${PWD}/${CONFIG_FILE} +fi + +if [ -z "${CONFIG_FILE}" ] ; then + echo "Missing -c flag" + usage +fi + +if [ ! -f "${CONFIG_FILE}" ] ; then + echo "Config file cannot be read" + usage +fi + +# Check if we have a uuid file. +if [ ! -f ${CONFIG_DIR}/device_id ] +then + echo "Creating device ID in ${CONFIG_DIR}/device_id" + cat /proc/sys/kernel/random/uuid > ${CONFIG_DIR}/device_id +fi + +# +# Generate a config file that will end up as +# /tmp/rvi/sys.config +# +( + cd /tmp/ + rm -rf rvi + export ERL_LIBS=${RVI_DIR}/setup:${RVI_DIR}/lib/ + ${RVI_DIR}/setup_gen rvi ${CONFIG_FILE} rvi +) + +# Did we succeed with config generation? +if [ "$?" != "0" ] +then + # Nope + exit "$?" +fi + +# Copy created config file to /etc/opt/rvi/sys.config, +# which is symlinked to by /opt/rvi/sys.config +cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config + +exec /opt/rvi/bin/rvi ${CMD} diff --git a/scripts/start_rvi.sh b/scripts/start_rvi.sh deleted file mode 100644 index 6683c52..0000000 --- a/scripts/start_rvi.sh +++ /dev/null @@ -1,71 +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 a correct configuration and launch an RVI release node. -# If a UUID file has not been created, it will be done at this time. -# - -SELF_DIR=$(dirname $(readlink -f "$0")) -CONFIG_DIR=/etc/opt/rvi -BIN_DIR=/opt/rvi - -usage() { - echo "Usage: $0 -c config_file" - echo " -c config_file Specify the configuration " - echo "Configuration data is read from the configuration file." - exit 1 -} - -while getopts "c:" o; do - case "${o}" in - c) - CONFIG_FILE=${OPTARG} - ;; - *) - usage - ;; - esac -done - -if [ -z "${CONFIG_FILE}" ] ; then - echo "Missing -c flag" - usage -fi - -# Check if we have a uuid file. -if [ ! -f ${CONFIG_DIR}/device_id ] -then - echo "Creating device ID in ${CONFIG_DIR}/device_id" - cat /proc/sys/kernel/random/uuid > ${CONFIG_DIR}/device_id -fi - -# -# Generate a config file that will end up as -# /tmp/rvi/sys.config -# -( - cd /tmp/ - rm -rf rvi - export ERL_LIBS=${BIN_DIR}/setup:${BIN_DIR}/lib/ - ${BIN_DIR}/setup_gen rvi $CONFIG_FILE rvi -) - -# Did we succeed with config generation? -if [ "$?" != "0" ] -then - # Nope - exit "$?" -fi - -# Copy created config file to /etc/opt/rvi/sys.config, -# which is symlinked to by /opt/rvi/sys.config -cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config - -exec /opt/rvi/bin/rvi start -- cgit v1.2.1 From ee219c20319fabe6b53fcc5f212ddbc0b169e981 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Thu, 19 Nov 2015 15:38:47 -0800 Subject: Recreated lost rvi.sh --- scripts/rvi.sh | 81 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) (limited to 'scripts') diff --git a/scripts/rvi.sh b/scripts/rvi.sh index 6e15d17..90ac3a2 100644 --- a/scripts/rvi.sh +++ b/scripts/rvi.sh @@ -18,19 +18,18 @@ RVI_DIR=/opt/rvi usage() { echo "Usage: $0 [-c config_file] start|stop|console" - echo " -c config_file Configuration file. " - echo " Not used with start and console." + echo " -c config_file Configuration file to launch rvi node with. " + echo " If omitted, previously used config file is used." echo - echo " start Start an rvi node with the given" - echo " configuration file." + echo " start Start an rvi node with the given configuration file." echo - echo " stop Stop an rvi node previously started" - echo " with start." + echo " stop Stop an rvi node previously started with start." echo echo " console Start an rvi in foreground mode." exit 1 } +CONFIG_FILE="" while getopts "c:" o; do case "${o}" in c) @@ -56,25 +55,6 @@ then exit $? fi -# Check if we need to prepend current dir -# to relative config file path -# - -if [ $(echo ${CONFIG_FILE} | cut -c 1,1) != "/" ] -then - CONFIG_FILE=${PWD}/${CONFIG_FILE} -fi - -if [ -z "${CONFIG_FILE}" ] ; then - echo "Missing -c flag" - usage -fi - -if [ ! -f "${CONFIG_FILE}" ] ; then - echo "Config file cannot be read" - usage -fi - # Check if we have a uuid file. if [ ! -f ${CONFIG_DIR}/device_id ] then @@ -82,23 +62,42 @@ then cat /proc/sys/kernel/random/uuid > ${CONFIG_DIR}/device_id fi -# -# Generate a config file that will end up as -# /tmp/rvi/sys.config -# -( - cd /tmp/ - rm -rf rvi - export ERL_LIBS=${RVI_DIR}/setup:${RVI_DIR}/lib/ - ${RVI_DIR}/setup_gen rvi ${CONFIG_FILE} rvi -) - -# Did we succeed with config generation? -if [ "$?" != "0" ] +if [ -n "${CONFIG_FILE}" ] then - # Nope - exit "$?" -fi + # + # Check if we need to prepend current dir + # to relative config file path + # + if [ $(echo ${CONFIG_FILE} | cut -c 1,1) != "/" ] + then + CONFIG_FILE=${PWD}/${CONFIG_FILE} + fi + + # Check that config file can be read. + if [ ! -r "${CONFIG_FILE}" ] ; then + echo "${CONFIG_FILE} cannot be opened for reading." + usage + fi + + # + # Generate a config file that will end up as + # /tmp/rvi/sys.config + # + ( + cd /tmp/ + rm -rf rvi + export ERL_LIBS=${RVI_DIR}/setup:${RVI_DIR}/lib/ + ${RVI_DIR}/setup_gen rvi ${CONFIG_FILE} rvi + ) + + # Did we succeed with config generation? + if [ "$?" != "0" ] + then + # Nope + echo "Failed to process configuration file." + exit "$?" + fi +fi # Copy created config file to /etc/opt/rvi/sys.config, # which is symlinked to by /opt/rvi/sys.config -- cgit v1.2.1 From 60387abe5b70d96e657c2630421865b908936910 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Fri, 20 Nov 2015 11:39:08 -0800 Subject: Fixed symlink reference to /etc/opt/rvi. Fixed incorrect directory reference when launching erlang rvi --- scripts/rvi.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/rvi.sh b/scripts/rvi.sh index 90ac3a2..4b04c27 100644 --- a/scripts/rvi.sh +++ b/scripts/rvi.sh @@ -97,10 +97,10 @@ then echo "Failed to process configuration file." exit "$?" fi -fi -# Copy created config file to /etc/opt/rvi/sys.config, -# which is symlinked to by /opt/rvi/sys.config -cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config + # Copy created config file to /etc/opt/rvi/sys.config, + # which is symlinked to by /opt/rvi/sys.config + cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config +fi exec /opt/rvi/bin/rvi ${CMD} -- cgit v1.2.1 From 3a20849c94020afba5f0384cc9979d02a7546762 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sat, 21 Nov 2015 16:55:12 -0800 Subject: Replaced by rvi_install --- scripts/setup_rvi_node.sh | 130 ---------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100755 scripts/setup_rvi_node.sh (limited to 'scripts') diff --git a/scripts/setup_rvi_node.sh b/scripts/setup_rvi_node.sh deleted file mode 100755 index 5dfe55f..0000000 --- a/scripts/setup_rvi_node.sh +++ /dev/null @@ -1,130 +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 Date: Sat, 21 Nov 2015 16:57:38 -0800 Subject: Now supports installs created by rvi_install. Supports start, stop, console, and attach. Will parse provided config file and store the processed result in -d directory (default is the home directory of rvi.sh /config). Supports separate log directory with -t. Default /tmp/rvi/config_file_name --- scripts/rvi.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/rvi.sh b/scripts/rvi.sh index 4b04c27..2a42aa3 100644 --- a/scripts/rvi.sh +++ b/scripts/rvi.sh @@ -13,11 +13,11 @@ # SELF_DIR=$(dirname $(readlink -f "$0")) -CONFIG_DIR=/etc/opt/rvi -RVI_DIR=/opt/rvi + +ERL=${ERL:=erl} usage() { - echo "Usage: $0 [-c config_file] start|stop|console" + echo "Usage: $0 -D config_dir -c config_file start|stop|console" echo " -c config_file Configuration file to launch rvi node with. " echo " If omitted, previously used config file is used." echo @@ -30,29 +30,47 @@ usage() { } CONFIG_FILE="" -while getopts "c:" o; do + +SNAME=rvi +COOKIE=rvi_cookie +unset CONFIG_DIR +unset LOG_DIR +while getopts "c:d:" o; do case "${o}" in c) CONFIG_FILE=${OPTARG} ;; + d) + CONFIG_DIR=${OPTARG} + ;; + l) + LOG_DIR=${OPTARG} + ;; *) usage ;; esac done +CONFIG_DIR=${CONFIG_DIR:=${SELF_DIR}/config} + shift $((${OPTIND}-1)) CMD=$1 -if [ "$CMD" != "start" -a "$CMD" != "stop" -a "$CMD" != "console" ] +if [ "${CMD}" != "start" -a "${CMD}" != "stop" -a "${CMD}" != "console" -a "${CMD}" != "ping" ] then usage fi -if [ "$CMD" = "stop" ] +export ERL_LIBS=${SELF_DIR}/rvi:${SELF_DIR}/rvi/deps:${SELF_DIR}/rvi/components +TMP_DIR=/tmp/rvi/$(basename ${CONFIG_FILE} .config) +LOG_DIR=${LOG_DIR:=${TMP_DIR}/log} + + +# Check that we have a config dir +if [ ! -d ${CONFIG_DIR} ] then - ${RVI_DIR}/bin/rvi stop - exit $? + install -d --mode=0755 ${CONFIG_DIR} fi # Check if we have a uuid file. @@ -62,7 +80,9 @@ then cat /proc/sys/kernel/random/uuid > ${CONFIG_DIR}/device_id fi -if [ -n "${CONFIG_FILE}" ] + + +if [ -s "${CONFIG_FILE}" ] then # # Check if we need to prepend current dir @@ -74,20 +94,18 @@ then fi # Check that config file can be read. - if [ ! -r "${CONFIG_FILE}" ] ; then + if [ ! -r "${CONFIG_FILE}" ] + then echo "${CONFIG_FILE} cannot be opened for reading." usage fi - # # Generate a config file that will end up as # /tmp/rvi/sys.config # ( - cd /tmp/ - rm -rf rvi - export ERL_LIBS=${RVI_DIR}/setup:${RVI_DIR}/lib/ - ${RVI_DIR}/setup_gen rvi ${CONFIG_FILE} rvi + cd ${CONFIG_DIR} + ${SELF_DIR}/setup_gen rvi ${CONFIG_FILE} rvi ) # Did we succeed with config generation? @@ -97,10 +115,37 @@ then echo "Failed to process configuration file." exit "$?" fi - - # Copy created config file to /etc/opt/rvi/sys.config, - # which is symlinked to by /opt/rvi/sys.config - cp /tmp/rvi/sys.config /etc/opt/rvi/sys.config +elif [ ${CMD} = "start" -o ${CMD} = "console" ] +then + echo "Missing -c config_file necessary for 'start' and 'console'" + usage fi + + +LAUNCH="${ERL} -boot ${CONFIG_DIR}/rvi/start -sname ${SNAME} -config ${CONFIG_DIR}/rvi/sys -setcookie ${COOKIE}" + +case "${CMD}" in + start) + install -d --mode 0755 ${TMP_DIR} + install -d --mode 0755 ${LOG_DIR} + exec run_erl -daemon ${TMP_DIR}/ ${LOG_DIR} "exec ${LAUNCH}" + ;; + + console) + exec ${LAUNCH} + ;; + + stop) + exec ${SELF_DIR}/nodetool -sname ${SNAME} -setcookie ${COOKIE} stop + ;; + + ping) + exec ${SELF_DIR}/nodetool -sname ${SNAME} -setcookie ${COOKIE} ping + ;; + + attach) + exec to_erl ${TMP_DIR} + ;; + +esac -exec /opt/rvi/bin/rvi ${CMD} -- cgit v1.2.1 From 941d217c1d7f4e4e613015b6717bc86fcd586e25 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sat, 21 Nov 2015 16:58:22 -0800 Subject: New install script that copies only app files, beam files, and a few scrits to target directory. Uses separately installed erlang to execute --- scripts/rvi_install.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 scripts/rvi_install.sh (limited to 'scripts') diff --git a/scripts/rvi_install.sh b/scripts/rvi_install.sh new file mode 100755 index 0000000..503c46f --- /dev/null +++ b/scripts/rvi_install.sh @@ -0,0 +1,75 @@ +#!/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 /dev/null 2>&1 + +install --mode=0755 -d ${TARGET_DIR}/rvi + +FILE_SET=$(find ebin components deps -name ebin -o -name priv) + +echo "Installing rvi at ${TARGET_DIR}." + +tar cf - ${FILE_SET} | (cd ${TARGET_DIR}/rvi ; tar xf - ) + +install --mode=0755 scripts/rvi.sh ${TARGET_DIR} +install --mode=0755 scripts/setup_gen ${TARGET_DIR} +install --mode=0755 rel/files/nodetool ${TARGET_DIR} + +echo "RVI installed under ${TARGET_DIR}" +echo "Start: ${TARGET_NAME}/rvi.sh start" +echo "Attach started RVI: ${TARGET_NAME}/rvi.sh attach" +echo "Stop: ${TARGET_NAME}/rvi.sh stop" +echo "Start console mode: ${TARGET_NAME}/rvi.sh console" + + + +exit 0 + -- cgit v1.2.1 From 2dbce8a6cf7a7d48487dbd1cc07ad78e4afea027 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sat, 21 Nov 2015 18:34:23 -0800 Subject: First stab at yocto service --- scripts/rvi.service.yocto | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/rvi.service.yocto (limited to 'scripts') diff --git a/scripts/rvi.service.yocto b/scripts/rvi.service.yocto new file mode 100644 index 0000000..bcb4305 --- /dev/null +++ b/scripts/rvi.service.yocto @@ -0,0 +1,18 @@ +# systemd(8) setup usde by Tizen and others. +[Unit] +Description=Remote Vehicle Interaction Service +Wants=network-online.target + +[Service] +Environment="HOME=/opt/rvi" +Type=forking +StandardOutput=journal +StandardError=journal +ExecStartPre=epmd -daemon +ExecStart=/bin/sh /opt/rvi/rvi.sh -d /etc/opt/rvi -c /etc/opt/rvi/rvi_yocto. start +ExecStop=/bin/sh /opt/rvi/rvi stop +ExecStopPost=epmd -kill +GuessMainPID=yes + +[Install] +# WantedBy=graphical.target multi-user.target -- cgit v1.2.1 From 074b94055bf9e3db2544d5fe3d7b3e09bf21d983 Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sat, 21 Nov 2015 18:35:20 -0800 Subject: Fixed typo --- scripts/rvi.service.yocto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/rvi.service.yocto b/scripts/rvi.service.yocto index bcb4305..1ddae5d 100644 --- a/scripts/rvi.service.yocto +++ b/scripts/rvi.service.yocto @@ -9,7 +9,7 @@ Type=forking StandardOutput=journal StandardError=journal ExecStartPre=epmd -daemon -ExecStart=/bin/sh /opt/rvi/rvi.sh -d /etc/opt/rvi -c /etc/opt/rvi/rvi_yocto. start +ExecStart=/bin/sh /opt/rvi/rvi.sh -d /etc/opt/rvi -c /etc/opt/rvi/rvi_yocto.config start ExecStop=/bin/sh /opt/rvi/rvi stop ExecStopPost=epmd -kill GuessMainPID=yes -- cgit v1.2.1 From 8f983bf7c0d1579f2d176d6e96d28ef621c7644b Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sun, 22 Nov 2015 11:54:21 -0800 Subject: Fixed usage documentation --- scripts/rvi_install.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/rvi_install.sh b/scripts/rvi_install.sh index 503c46f..7572aa9 100755 --- a/scripts/rvi_install.sh +++ b/scripts/rvi_install.sh @@ -28,7 +28,7 @@ SELF_DIR=$(dirname $(readlink -f "$0")) SETUP_GEN=$SELF_DIR/setup_gen # Ulf's kitchen sink setup utility usage() { - echo "Usage: $0 target_dir" + echo "Usage: $0 binary_dir" echo echo "RVI will be installed in 'target_dir'." echo @@ -64,12 +64,10 @@ install --mode=0755 scripts/setup_gen ${TARGET_DIR} install --mode=0755 rel/files/nodetool ${TARGET_DIR} echo "RVI installed under ${TARGET_DIR}" -echo "Start: ${TARGET_NAME}/rvi.sh start" -echo "Attach started RVI: ${TARGET_NAME}/rvi.sh attach" -echo "Stop: ${TARGET_NAME}/rvi.sh stop" -echo "Start console mode: ${TARGET_NAME}/rvi.sh console" - - +echo "Start: ${TARGET_DIR}/rvi.sh -c 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 console" exit 0 -- cgit v1.2.1 From eb9e409706fea8ba214ee41e5c79d5a9177814cd Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sun, 22 Nov 2015 11:55:04 -0800 Subject: Now uses default configuration file if not specified --- scripts/rvi.sh | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/rvi.sh b/scripts/rvi.sh index 2a42aa3..e713784 100644 --- a/scripts/rvi.sh +++ b/scripts/rvi.sh @@ -17,15 +17,31 @@ SELF_DIR=$(dirname $(readlink -f "$0")) ERL=${ERL:=erl} usage() { - echo "Usage: $0 -D config_dir -c config_file start|stop|console" + echo "Usage: $0 -d config_dir -c config_file -l log_dir \\" + echo " start|stop|console|attach|ping" + echo echo " -c config_file Configuration file to launch rvi node with. " - echo " If omitted, previously used config file is used." + echo " If omitted the rvi.config in the configuration " + echo " directory will be used." + echo + echo " -d config_dir Directory to put generated uuid 'device_id' file and" + echo " processed config files." + echo " Defauts to the 'config' directory under the directory" + echo " that rvi.sh resides in." + echo + echo " -l log_dir The directory to store log files in." + 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 - 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 + echo " ping Ping to check if an rvi node is up. Returns 0 if up." exit 1 } @@ -82,8 +98,13 @@ fi -if [ -s "${CONFIG_FILE}" ] +# +# See if we need to process a config file +# +if [ ${CMD} = "start" -o ${CMD} = "console" ] then + # Default to rvi.config + CONFIG_FILE=${CONFIG_FILE:=${CONFIG_DIR}/rvi.config} # # Check if we need to prepend current dir # to relative config file path @@ -115,10 +136,6 @@ then echo "Failed to process configuration file." exit "$?" fi -elif [ ${CMD} = "start" -o ${CMD} = "console" ] -then - echo "Missing -c config_file necessary for 'start' and 'console'" - usage fi -- cgit v1.2.1 From 15646255321f478dd53502cb26f60b26d1339cea Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Sun, 22 Nov 2015 11:57:50 -0800 Subject: Renamed rvi.service rvi.service.tizen for Tizen-specific systemd integration. More work probably needed --- scripts/rvi.service.tizen | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/rvi.service.tizen (limited to 'scripts') diff --git a/scripts/rvi.service.tizen b/scripts/rvi.service.tizen new file mode 100644 index 0000000..1220eb9 --- /dev/null +++ b/scripts/rvi.service.tizen @@ -0,0 +1,19 @@ +# systemd(8) setup usde by Tizen and others. +[Unit] +Description=Remote Vehicle Interaction Service +Wants=network-online.target + +[Service] +Environment="HOME=/opt/rvi-0.4.0" +Type=forking +StandardOutput=journal +StandardError=journal +ExecStartPre=/usr/bin/chsmack --access User /home/app/content/Documents/vin +ExecStartPre=/opt/rvi-0.4.0/erts-5.10.4/bin/epmd -daemon +ExecStart=/bin/sh /opt/rvi-0.4.0/bin/rvi start +ExecStop=/bin/sh /opt/rvi-0.4.0/bin/rvi stop +ExecStopPost=/opt/rvi-0.4.0/erts-5.10.4/bin/epmd -kill +GuessMainPID=yes + +[Install] +WantedBy=graphical.target multi-user.target -- cgit v1.2.1