diff options
-rw-r--r-- | CONFIGURE.md | 4 | ||||
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | rebar.config | 2 | ||||
-rw-r--r-- | rpm/SPECS/rvi-0.2.spec | 62 | ||||
-rw-r--r-- | rvi_sample.config | 10 | ||||
-rwxr-xr-x | scripts/rvi (renamed from rpm/rvi) | 11 | ||||
-rw-r--r-- | scripts/rvi.service | 18 | ||||
-rwxr-xr-x | scripts/rvi_node.sh (renamed from rvi_node.sh) | 5 | ||||
-rwxr-xr-x | scripts/setup_gen | bin | 0 -> 63569 bytes | |||
-rwxr-xr-x | scripts/setup_rvi_node.sh (renamed from setup_rvi_node.sh) | 15 | ||||
-rw-r--r-- | tizen.config (renamed from tizen_vehicle.config) | 6 |
11 files changed, 113 insertions, 28 deletions
diff --git a/CONFIGURE.md b/CONFIGURE.md index 0974f98..2e52c47 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -432,7 +432,7 @@ release. If a configuration file, ```test.config``` is to be used when building release ```test_release```, the following command can be run from the build root: - ./setup_rvi_node.sh test_rel test.config + ./script/setup_rvi_node.sh test_rel test.config Once executed (and no errors were found in test.config), a subdirectory called ```test_rel``` has been created. This directory @@ -448,7 +448,7 @@ In order to start the test release, named ```test_rel```, created in the previous chapter, the following command is run from the build root: - ./rvi_node.sh -n tes_rel + ./scripts/rvi_node.sh -n tes_rel When a development release is started the erlang console prompt will be displayed at the end of the startup process, allowing for manual @@ -14,9 +14,6 @@ VERSION=0.2 -SETUP_GEN=./deps/setup/setup_gen - - all: deps compile @@ -44,8 +41,9 @@ rpmclean: rpm_tarball: rpmclean clean tar czf /tmp/rvi-$(VERSION).tgz BUILD.md CONFIGURE.md doc \ hvac_demo LICENSE Makefile README.md rebar rebar.config rel \ - RELEASE.md rpm rvi_node.sh rvi_sample.config setup_rvi_node.sh \ - src tizen_vehicle.config TODO + RELEASE.md rpm scripts/rvi scripts/rvi.service scripts/rvi_node.sh \ + rvi_sample.config scripts/setup_rvi_node.sh src \ + tizen.config TODO mv /tmp/rvi-$(VERSION).tgz ./rpm/SOURCES/ diff --git a/rebar.config b/rebar.config index f4b875b..c49fb80 100644 --- a/rebar.config +++ b/rebar.config @@ -8,7 +8,7 @@ {sub_dirs, ["rel"]}. {deps, [ - {setup, ".*", {git, "https://github.com/uwiger/setup.git", "HEAD"}}, +%% {setup, ".*", {git, "https://github.com/uwiger/setup.git", "HEAD"}}, {protocol, ".*", {git, "https://gerrit.automotivelinux.org/gerrit/RVI/protocol", "master"}}, {data_link_bert_rpc, ".*", {git, "https://gerrit.automotivelinux.org/gerrit/RVI/data_link_bert_rpc", "master"}}, {authorize, ".*", {git, "https://gerrit.automotivelinux.org/gerrit/RVI/authorize", "master"}}, diff --git a/rpm/SPECS/rvi-0.2.spec b/rpm/SPECS/rvi-0.2.spec index 2e7d335..dcb17d6 100644 --- a/rpm/SPECS/rvi-0.2.spec +++ b/rpm/SPECS/rvi-0.2.spec @@ -1,4 +1,4 @@ -Summary: Remote Vehicle Interaction Node +Summary: Remote Vehicle Interaction Noed Name: rvi Version: 0.2 Release: 1 @@ -25,16 +25,68 @@ environment. %build make deps make compile -./setup_rvi_node.sh -n rvi-$RPM_PACKAGE_VERSION -c rvi_sample.config - +# Create a tizen node if that is what we have. +if dmesg | grep -q Tizen; then + ./scripts/setup_rvi_node.sh -n rvi-$RPM_PACKAGE_VERSION -c tizen.config +else + ./scripts/setup_rvi_node.sh -n rvi-$RPM_PACKAGE_VERSION -c rvi_sample.config +fi %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/opt/rvi-$RPM_PACKAGE_VERSION -cp -ar * $RPM_BUILD_ROOT/opt/rvi-$RPM_PACKAGE_VERSION +cp -ar rel/rvi-$RPM_PACKAGE_VERSION $RPM_BUILD_ROOT/opt/ + +# If we are installing on Tizen, use the systemd setup +# If not on Tizen, assume std debian setup +if dmesg | grep -q Tizen; then + mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/ + mkdir -p $RPM_BUILD_ROOT/etc/systemd/system/multi-user.target.wants/ + install ./scripts/rvi.service $RPM_BUILD_ROOT/usr/lib/systemd/system/rvi.service + ln -fsr $RPM_BUILD_ROOT/usr/lib/systemd/system/rvi.service \ + $RPM_BUILD_ROOT/etc/systemd/system/multi-user.target.wants/rvi.service + echo "/usr/lib/systemd/system/rvi.service + /etc/systemd/system/multi-user.target.wants/rvi.service" > file_list.txt +else + mkdir -p $RPM_BUILD_ROOT/etc/init.d + mkdir -p $RPM_BUILD_ROOT/etc/rc0.d + mkdir -p $RPM_BUILD_ROOT/etc/rc1.d + mkdir -p $RPM_BUILD_ROOT/etc/rc2.d + mkdir -p $RPM_BUILD_ROOT/etc/rc3.d + mkdir -p $RPM_BUILD_ROOT/etc/rc4.d + mkdir -p $RPM_BUILD_ROOT/etc/rc5.d + mkdir -p $RPM_BUILD_ROOT/etc/rc6.d + install ./scripts/rvi $RPM_BUILD_ROOT/etc/init.d + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc0.d/K20-rvi + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc1.d/K20-rvi + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc2.d/S50-rvi + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc3.d/S50-rvi + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc4.d/S50-rvi + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc5.d/S50-rvi + ln -fsr $RPM_BUILD_ROOT/etc/init.d/rvi $RPM_BUILD_ROOT/etc/rc6.d/K20-rvi + + echo "/etc/init.d + /etc/rc0.d + /etc/rc1.d + /etc/rc2.d + /etc/rc3.d + /etc/rc4.d + /etc/rc5.d + /etc/rc6.d" > file_list.txt + +fi + + +# Make global config file easier to access. +ln -fsr $RPM_BUILD_ROOT/opt/rvi-$RPM_PACKAGE_VERSION/releases/1/sys.config \ + $RPM_BUILD_ROOT/opt/rvi-$RPM_PACKAGE_VERSION/sys.config +%post +if dmesg | grep -q Tizen; then + /usrbin/systemctl daemon-reload +fi %clean rm -rf $RPM_BUILD_ROOT -%files +%files -f file_list.txt %defattr(-,root,root) /opt/rvi-0.2 diff --git a/rvi_sample.config b/rvi_sample.config index 0e8c683..2b94359 100644 --- a/rvi_sample.config +++ b/rvi_sample.config @@ -28,7 +28,7 @@ compiler, ssl, asn1, - + wse, %% RVI-specific apps. %% Do not touch unless you are replacing apps with your own @@ -122,7 +122,8 @@ %% { static_nodes, [ - { "jlr.com/backend/", "localhost:8807" } + %% rvi1.nginfotpdx.net is the JLR hosted RVI server. + { "jlr.com/backend/", "38.129.64.13:8807" } ] }, @@ -138,8 +139,11 @@ %% The host and address given in URL should route to the port given %% in exo_http_opts below. %% + %% The web socket integrates with the rvi.js javascript code + %% that connects Tizen IVI to the RVI system. [ { url, "http://127.0.0.1:8811" }, - { exo_http_opts, [ { port, 8811 } ] } + { exo_http_opts, [ { port, 8811 } ] }, + { websocket, [ { port, 8818}]} ] }, { service_discovery, @@ -6,7 +6,10 @@ # 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. +# export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" . /lib/lsb/init-functions @@ -15,7 +18,7 @@ set -e case "$1" in start) log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" - if /opt/rvi-0.2/rvi/bin/rvi start; then + if /opt/rvi-0.2/bin/rvi start; then log_end_msg 0 else log_end_msg 1 @@ -23,7 +26,7 @@ case "$1" in ;; stop) log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" - if /opt/rvi-0.2/rvi/bin/rvi stop; then + if /opt/rvi-0.2/bin/rvi stop; then log_end_msg 0 else log_end_msg 1 @@ -31,7 +34,7 @@ case "$1" in ;; restart) log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" - if /opt/rvi-0.2/rvi/bin/rvi restart; then + if /opt/rvi-0.2/bin/rvi restart; then log_end_msg 0 else log_end_msg 1 diff --git a/scripts/rvi.service b/scripts/rvi.service new file mode 100644 index 0000000..a085cdf --- /dev/null +++ b/scripts/rvi.service @@ -0,0 +1,18 @@ +# systemd(8) setup used by Tizen and others. +[Unit] +Description=Remote Vehicle Interaction Service +Wants=network-online.target + +[Service] +Environment="HOME=/opt/rvi-2.0" +Type=forking +StandardOutput=journal +StandardError=journal +ExecStartPre=/opt/rvi-0.2/erts-5.10.3/bin/epmd -daemon +ExecStart=/bin/sh /opt/rvi-0.2/bin/rvi start +ExecStop=/bin/sh /opt/rvi-0.2/bin/rvi stop +ExecStopPost=/opt/rvi-0.2/erts-5.10.3/bin/epmd -kill +GuessMainPID=yes + +[Install] +WantedBy=graphical.target multi-user.target diff --git a/rvi_node.sh b/scripts/rvi_node.sh index 1d9dbb8..2f5a2c4 100755 --- a/rvi_node.sh +++ b/scripts/rvi_node.sh @@ -19,6 +19,8 @@ # create the necessary config files and erlang boot scripts. # +SELF_DIR=$(dirname $(readlink -f "$0")) + usage() { echo "Usage: $0 -n node_name" echo " -n node_name Specify the name of the rvi node to launch" @@ -50,7 +52,8 @@ if [ "${mode}" = "build" ] then if [ ! -f ${node_name}/sys.config ] then - echo "Node ${node_name} not setup. Please run ./setup_rvi_node.sh ${node_name} <configuration_file>" + echo "Node ${node_name} not setup. Please run: " + echo "$SELF_DIR/setup_rvi_node.sh -n ${node_name} -c <configuration_file>" exit 2 fi exec erl -boot ${node_name}/start -config ${node_name}/sys diff --git a/scripts/setup_gen b/scripts/setup_gen Binary files differnew file mode 100755 index 0000000..2f4ad8f --- /dev/null +++ b/scripts/setup_gen diff --git a/setup_rvi_node.sh b/scripts/setup_rvi_node.sh index aabe298..ba7c421 100755 --- a/setup_rvi_node.sh +++ b/scripts/setup_rvi_node.sh @@ -23,7 +23,9 @@ # # In order to create a standalone release, use create_rvi_release.sh # -SETUP_GEN=./deps/setup/setup_gen # Ulf's kitchen sink setup utility + +SELF_DIR=$(dirname $(readlink -f "$0")) +SETUP_GEN=$SELF_DIR/setup_gen # Ulf's kitchen sink setup utility usage() { echo "Usage: $0 [-d] -n node_name -c config_file" @@ -40,17 +42,17 @@ usage() { echo "The generated node will be created in a subdirectory with the same" echo "name as the node name." echo - echo "The created node can be started with: ./rvi_node -n node_name" + echo "The created node can be started with: $SELF_DIR/rvi_node -n node_name" echo echo "If the node was created with the -d flag, you need to start" - echo "the node with ./rvi_node -d -n node_name" + echo "the node with $SELF_DIR/rvi_node -d -n node_name" echo echo "Configuration file examples can be found in hvac_demo/vehicle.config" echo echo "The -d flag creates a development release that uses the erlang " echo "binaries found in ebin/ and deps/*/ebin. This means that new builds," echo "created by make, can be run directly through " - echo "./rvi_node -n node_name without having to run ./setup_rvi_node.sh ." + echo "$SELF_DIR/rvi_node -n node_name without having to run ./setup_rvi_node.sh ." echo echo "If the -d flag is omitted, the release will be self-contained in the " echo "newly created subdirectory rel/[node_name]." @@ -102,7 +104,7 @@ $SETUP_GEN $NODE_NAME $CONFIG_NAME $NODE_NAME if [ "${build_type}" = "dev" -o "${build_type}" = "rpm" ] then echo "RVI Node $NODE_NAME has been setup." - echo "Launch with ./rvi_node.sh -n $NODE_NAME" + echo "Launch with $SELF_DIR/rvi_node.sh -n $NODE_NAME" exit else echo "Building stand alone release for $NODE_NAME" @@ -111,7 +113,8 @@ else ./rebar generate # Rename the release after the node name mv rel/rvi rel/$NODE_NAME - echo "Stand alone release for $NODE_NAME created under ./rel/$NODE_NAME." + echo "Stand alone release for $NODE_NAME created under project " + echo "root directory's ./rel/$NODE_NAME." echo echo "Start: ./rel/$NODE_NAME/bin/rvi start" echo "Attach console: ./rel/$NODE_NAME/bin/rvi attach" diff --git a/tizen_vehicle.config b/tizen.config index 72d0d57..1fb0eac 100644 --- a/tizen_vehicle.config +++ b/tizen.config @@ -6,7 +6,10 @@ %% Mozilla Public License, version 2.0. The full text of the %% Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ %% -%% Configuration file for the (in-vehicle) IVI used by the hvac_demo +%%------------- +%% Configuration file for the Tizen version of IVI +%% This setup will connect to the rvi1.nginfotpdx.net server +%%------------ %% %% See ../hvac_demo/README.md for details on the demo. %% @@ -140,6 +143,7 @@ %% [ { url, "http://127.0.0.1:8811" }, { exo_http_opts, [ { port, 8811 } ] }, + %% Websocket is used by Tizen's rvi.js to interact with RVI. { websocket, [ { port, 8818}]} ] }, |