summaryrefslogtreecommitdiff
path: root/ambd
diff options
context:
space:
mode:
Diffstat (limited to 'ambd')
-rw-r--r--ambd/CMakeLists.txt13
-rw-r--r--ambd/ambd.in50
-rw-r--r--ambd/core.cpp12
3 files changed, 59 insertions, 16 deletions
diff --git a/ambd/CMakeLists.txt b/ambd/CMakeLists.txt
index 4c66e05e..c17222a0 100644
--- a/ambd/CMakeLists.txt
+++ b/ambd/CMakeLists.txt
@@ -36,7 +36,12 @@ add_executable(ambd ${ambd_sources})
include_directories(${include_dirs} )
target_link_libraries(ambd ${link_libraries} dl amb ${gio_LIBRARIES})
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.in.json ${CMAKE_CURRENT_BINARY_DIR}/config @ONLY)
-
-install (TARGETS ambd RUNTIME DESTINATION bin)
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/config DESTINATION /etc/ambd)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.in.json ${CMAKE_CURRENT_BINARY_DIR}/config @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ambd.in ${CMAKE_CURRENT_BINARY_DIR}/init.d/ambd @ONLY)
+
+install(TARGETS ambd RUNTIME DESTINATION bin)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config DESTINATION /etc/ambd)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/init.d/ambd
+ DESTINATION /etc/init.d/
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
diff --git a/ambd/ambd.in b/ambd/ambd.in
new file mode 100644
index 00000000..95a2a5b7
--- /dev/null
+++ b/ambd/ambd.in
@@ -0,0 +1,50 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: ambd
+# Required-Start: $remote_fs
+# Required-Stop: $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Automotive Message Broker daemon
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+[ -f /etc/default/ambd ] && . /etc/default/ambd
+
+case "$1" in
+ start)
+ echo -n "Starting Automotive Message Broker daemon: "
+ start-stop-daemon -S -x @CMAKE_INSTALL_PREFIX@/bin/ambd -- -D
+ if [ $? = 0 ]; then
+ echo "ambd."
+ else
+ echo "(failed.)"
+ fi
+ ;;
+ stop)
+ echo -n "Stopping Automotive Message Broker daemon: "
+ start-stop-daemon -K -x @CMAKE_INSTALL_PREFIX@/bin/ambd
+ echo "apmd."
+ ;;
+ status)
+ status @CMAKE_INSTALL_PREFIX@/bin/ambd;
+ exit $?
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ exit
+ ;;
+ *)
+ echo "Usage: /etc/init.d/ambd {start|stop|status|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/ambd/core.cpp b/ambd/core.cpp
index 02e4a08e..419c078e 100644
--- a/ambd/core.cpp
+++ b/ambd/core.cpp
@@ -166,26 +166,14 @@ void Core::updateProperty(AbstractPropertyType *value, const string & uuid)
updateProperty(value);
else if(value->priority == AbstractPropertyType::High)
{
- value->destroyed.push_back([this](AbstractPropertyType* v)
- {
- updatePropertyQueueHigh.remove(v);
- });
updatePropertyQueueHigh.append(value);
}
else if(value->priority == AbstractPropertyType::Normal)
{
- value->destroyed.push_back([this](AbstractPropertyType* v)
- {
- updatePropertyQueue.remove(v);
- });
updatePropertyQueue.append(value);
}
else if(value->priority == AbstractPropertyType::Low)
{
- value->destroyed.push_back([this](AbstractPropertyType* v)
- {
- updatePropertyQueueLow.remove(v);
- });
updatePropertyQueueLow.append(value);
}
}