summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Feuer <mfeuer@jaguarllandrover.com>2015-11-28 17:46:28 -0800
committerMagnus Feuer <mfeuer@jaguarllandrover.com>2015-11-28 17:46:28 -0800
commita7d0ad11041170fdec6de0b9a5981ce14c3089af (patch)
treef671ec4edeacc5015a1d7fbef3390e48fa99bed8
parent42397d3884ed6a6a44205387c236f981b5501921 (diff)
downloadrvi_core-a7d0ad11041170fdec6de0b9a5981ce14c3089af.tar.gz
Temporary commit
-rw-r--r--Makefile3
-rw-r--r--scripts/rvi_ctl53
-rwxr-xr-xscripts/rvi_install.sh21
3 files changed, 28 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 0da9e66..df0315f 100644
--- a/Makefile
+++ b/Makefile
@@ -79,6 +79,7 @@ debian_package: clean debian_clean
#
tar czf ./debian_build/rvi_$(VERSION).orig.tar.gz --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" $(SRC_LIST) debian
# Unpack the created tar file
+ install -D --mode=0644 rvi_yocto.config ./debian_build/rvi-$(VERSION)/etc/rvi/rvi.config
(cd ./debian_build; tar xf rvi_$(VERSION).orig.tar.gz)
# Descend into the unpacked directory and build.
(cd ./debian_build/rvi-$(VERSION); debuild -uc -us)
@@ -87,6 +88,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 $(DESTDIR)/opt/rvi $(DESTDIR)/var/opt/rvi $(DESTDIR)/var/opt/log/rvi
+ ./scripts/rvi_install.sh $(DESTDIR)/opt/rvi $(DESTDIR)/opt/rvi $(DESTDIR)/var/opt/log/rvi
install --mode=0755 -d $(DESTDIR)/etc/opt/rvi/
install --mode=0644 rvi_yocto.config $(DESTDIR)/etc/opt/rvi/rvi.config
diff --git a/scripts/rvi_ctl b/scripts/rvi_ctl
index a1e4d81..8bacaf2 100644
--- a/scripts/rvi_ctl
+++ b/scripts/rvi_ctl
@@ -1,6 +1,6 @@
#!/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/
@@ -15,18 +15,18 @@
# Assignment of default values done by rvi_install.sh
echo ${RVI_LIBDIR:="__RVI_LIBDIR__"} > /dev/null
echo ${RVI_BINDIR:="__RVI_BINDIR__"} > /dev/null
-echo ${RVI_RUNDIR:="__RVI_RUNDIR__"} > /dev/null
echo ${RVI_LOGDIR:="__RVI_LOGDIR__"} > /dev/null
echo ${ERL:=erl} > /dev/null
+
usage() {
- echo "Usage: $0 -d config_dir -c config_file -l log_dir \\"
+ 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 the rvi.config in the runtime "
- echo " directory will be used."
+ echo " -c config_file Configuration file to launch rvi node with."
+ echo " Mandatory for start and console. Ignored for"
+ echo " all other commands."
echo
echo " start Start an rvi node with the given configuration file."
echo
@@ -40,7 +40,6 @@ usage() {
echo "\$RVI_LIBDIR ($RVI_LIBDIR) Location of RVI library files."
echo "\$RVI_BINDIR ($RVI_BINDIR) Location of binary files."
echo "\$RVI_LOGDIR ($RVI_LOGDIR) Location of log files."
- echo "\$RVI_RUNDIR ($RVI_RUNDIR) Location of runtime files."
exit 1
}
@@ -61,40 +60,26 @@ done
shift $((${OPTIND}-1))
CMD=$1
-if [ -z "${CONFIG_FILE}" ]
-then
- echo "Missing -c <config_file> argument."
- usage
-fi
if [ "${CMD}" != "start" -a "${CMD}" != "stop" -a "${CMD}" != "console" -a "${CMD}" != "ping" ]
then
usage
fi
+RUNDIR=${RVI_RUNDIR:-"/tmp/rvi"}/$(basename ${CONFIG_FILE} .config)
export ERL_LIBS=${RVI_LIBDIR}:${RVI_LIBDIR}/deps:${RVI_LIBDIR}/components
-
-# Check that we have a runtime dir, if not create it
-if [ ! -d ${RVI_RUNDIR} ]
-then
- install -D -d --mode=0755 ${RVI_RUNDIR}
-fi
-
-# Check if we have a uuid file.
-if [ ! -f ${RVI_RUNDIR}/device_id ]
-then
- echo "Creating device ID in ${RVI_RUNDIR}/device_id"
- cat /proc/sys/kernel/random/uuid > ${RVI_RUNDIR}/device_id
-fi
-
-
#
# See if we need to process a config file
#
if [ ${CMD} = "start" -o ${CMD} = "console" ]
then
+ if [ -z "${CONFIG_FILE}" ]
+ then
+ echo "Missing -c <config_file> argument."
+ usage
+ fi
#
# Check if we need to prepend current dir
# to relative config file path
@@ -112,10 +97,12 @@ then
fi
#
# Generate a config file that will end up as
- # /tmp/rvi/sys.config
+ # /tmp/rvi/[cfg]/sys.config
#
(
- cd ${RVI_RUNDIR}
+ rm -rf ${RUNDIR}
+ install -D -d --mode=0755 ${RUNDIR}
+ cd ${RUNDIR}
${RVI_BINDIR}/setup_gen rvi ${CONFIG_FILE} rvi
)
@@ -127,15 +114,13 @@ then
exit "$?"
fi
fi
-
-TMP_DIR=${RVI_RUNDIR}/$(basename ${CONFIG_FILE} .config)
-LAUNCH="${ERL} -boot ${RVI_RUNDIR}/rvi/start -sname ${SNAME} -config ${RVI_RUNDIR}/rvi/sys -setcookie ${COOKIE}"
+LAUNCH="${ERL} -boot ${RUNDIR}/rvi/start -sname ${SNAME} -config ${RUNDIR}/rvi/sys -setcookie ${COOKIE}"
case "${CMD}" in
start)
install -D -d --mode 0755 ${RVI_LOGDIR}
- exec run_erl -daemon ${RVI_RUNDIR}/ ${RVI_LOGDIR} "exec ${LAUNCH}"
+ exec run_erl -daemon ${RUNDIR}/ ${RVbI_LOGDIR} "exec ${LAUNCH}"
;;
console)
@@ -151,7 +136,7 @@ case "${CMD}" in
;;
attach)
- exec to_erl ${RVI_RUNDIR}
+ exec to_erl ${RUNDIR}
;;
esac
diff --git a/scripts/rvi_install.sh b/scripts/rvi_install.sh
index bde3180..4fccf54 100755
--- a/scripts/rvi_install.sh
+++ b/scripts/rvi_install.sh
@@ -16,11 +16,10 @@ SELF_DIR=$(dirname $(readlink -f "$0"))
SETUP_GEN=$SELF_DIR/setup_gen # Ulf's kitchen sink setup utility
usage() {
- echo "Usage: $0 binary_dir library_dir runtime_dir log_dir [prefix_strip]"
+ echo "Usage: $0 binary_dir library_dir log_dir [prefix_strip]"
echo
echo "RVI binaries will be installed in 'binary_dir'."
echo "RVI libraries will be installed in 'library_dir'."
- echo "RVI runtime files will be installed in 'runtime_dir'."
echo "RVI logging will be done in 'log_dir'."
echo
echo "If 'prefix_strip' is provided, that part of the directories above"
@@ -33,8 +32,8 @@ usage() {
echo "Useful in build systems where packages are built up"
echo "in subdirectories."
echo
- echo "The created node can be started with: 'binary_dir'/rvi"
- echo "RVI in 'library_dir' will rely on a separate erlang install"
+ echo "The created node can be started with: 'binary_dir'/rvi_ctl"
+ echo "The RVI installation will rely on a separate erlang install"
echo "to run."
exit 1
}
@@ -43,7 +42,7 @@ usage() {
shift $((${OPTIND}-1))
-if [ "${#}" != "4" -a "${#}" != "5" ]
+if [ "${#}" != "3" -a "${#}" != "4" ]
then
echo "Wrong number of arguments."
usage
@@ -51,12 +50,11 @@ fi
BIN_DIR=$1
LIB_DIR=$2
-RUN_DIR=$3
-LOG_DIR=$4
+LOG_DIR=$3
-if [ "${#}" = "5" ]
+if [ "${#}" = "4" ]
then
- PREFIX_STRIP=$5
+ PREFIX_STRIP=$4
fi
rm -rf ${LIB_DIR} ${BIN_DIR} > /dev/null 2>&1
@@ -64,7 +62,6 @@ rm -rf ${LIB_DIR} ${BIN_DIR} > /dev/null 2>&1
install --mode=0755 -d ${BIN_DIR}
install --mode=0755 -d ${LIB_DIR}
install --mode=0755 -d ${LOG_DIR}
-install --mode=0755 -d ${RUN_DIR}
FILE_SET=$(find ebin components deps -name ebin -o -name priv)
@@ -75,18 +72,15 @@ if [ -s "${PREFIX_STRIP}" ]
then
STRIP_BIN_DIR=$(echo ${BIN_DIR} | sed "s|^${PREFIX_STRIP}||")
STRIP_LIB_DIR=$(echo ${LIB_DIR} | sed "s|^${PREFIX_STRIP}||")
- STRIP_RUN_DIR=$(echo ${RUN_DIR} | sed "s|^${PREFIX_STRIP}||")
STRIP_LOG_DIR=$(echo ${LOG_DIR} | sed "s|^${PREFIX_STRIP}||")
else
STRIP_BIN_DIR=${BIN_DIR}
STRIP_LIB_DIR=${LIB_DIR}
- STRIP_RUN_DIR=${RUN_DIR}
STRIP_LOG_DIR=${LOG_DIR}
fi
sed -e "s|__RVI_LIBDIR__|${STRIP_LIB_DIR}|g" \
-e "s|__RVI_BINDIR__|${STRIP_BIN_DIR}|g" \
- -e "s|__RVI_RUNDIR__|${STRIP_RUN_DIR}|g" \
-e "s|__RVI_LOGDIR__|${STRIP_LOG_DIR}|g" < scripts/rvi_ctl > /tmp/rvi_ctl
install --mode=0755 /tmp/rvi_ctl ${BIN_DIR}
@@ -95,7 +89,6 @@ install --mode=0755 rel/files/nodetool ${BIN_DIR}
echo "RVI binary files installed under ${BIN_DIR}"
echo "RVI library files installed under ${LIB_DIR}"
-echo "RVI runtime files installed under ${RUN_DIR}"
echo "RVI log files installed under ${LOG_DIR}"
echo
echo "Start: ${BIN_DIR}/rvi_ctl -c <config_file> start"