Various changes relating to build on Ubuntu and Fedora Linux. 91/44191/8
authorDariusz Michaluk <d.michaluk@samsung.com>
Fri, 17 Jul 2015 13:27:57 +0000 (15:27 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 27 Jul 2015 13:17:17 +0000 (15:17 +0200)
[Bug/Feature]   Various changes relating to build on Ubuntu and Fedora Linux.
[Cause]         N/A
[Solution]      N/A
Verification]   Build, run server, run tests.

Change-Id: Ie9f8c05a0de96b0dc07d506657a48f6dd1b074b4

33 files changed:
CMakeLists.txt
client/CMakeLists.txt
libs/config/CMakeLists.txt
libs/config/from-json-visitor.hpp
libs/config/from-kvjson-visitor.hpp
libs/config/to-json-visitor.hpp
libs/ipc/CMakeLists.txt
libs/ipc/internals/socket.cpp
libs/logger/CMakeLists.txt
libs/logger/backend-journal.cpp
packaging/vasum.spec
server/CMakeLists.txt
server/configs/CMakeLists.txt
server/configs/templates/ubuntu.conf [new file with mode: 0644]
server/configs/templates/ubuntu.sh [new file with mode: 0755]
server/host-dbus-connection.cpp
server/main.cpp
tests/unit_tests/CMakeLists.txt
tests/unit_tests/configs/CMakeLists.txt
tests/unit_tests/configs/templates/buggy-template.conf
tests/unit_tests/configs/templates/console-dbus.conf.in
tests/unit_tests/configs/templates/console-ipc.conf.in
tests/unit_tests/configs/templates/default.conf
tests/unit_tests/configs/templates/missing.conf
tests/unit_tests/configs/templates/test-no-shutdown.conf
tests/unit_tests/dbus/test-client.cpp
tests/unit_tests/dbus/test-server.cpp
tests/unit_tests/dbus/ut-connection.cpp
tests/unit_tests/ipc/ut-socket.cpp
tests/unit_tests/lxc/ut-zone.cpp
tests/unit_tests/server/ut-zone.cpp
wrapper/CMakeLists.txt
zone-daemon/main.cpp

index 4e9e4d4..5203a6a 100644 (file)
@@ -32,7 +32,7 @@ INCLUDE(FindPkgConfig)
 INCLUDE(GNUInstallDirs)
 
 ## Color output if it's possible:
-IF (( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.3))
+IF (( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))
       OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ))
 
     ADD_DEFINITIONS("-fdiagnostics-color=always")
@@ -91,11 +91,6 @@ ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
 ADD_DEFINITIONS(-DUSE_EXEC)
 ADD_DEFINITIONS(-D__STDC_LIMIT_MACROS)
 
-PKG_SEARCH_MODULE(JSON_C REQUIRED json json-c)
-IF(JSON_C_VERSION GREATER 0.11)
-    ADD_DEFINITIONS(-DJSON_C_VERSION_NEW)
-ENDIF(JSON_C_VERSION GREATER 0.11)
-
 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     # Warn about documentation problems
     ADD_DEFINITIONS("-Wdocumentation")
@@ -133,6 +128,9 @@ ADD_DEFINITIONS(-DTTY_GROUP="${TTY_GROUP}")
 IF(NOT WITHOUT_DBUS)
     ADD_DEFINITIONS(-DDBUS_CONNECTION)
 ENDIF(NOT WITHOUT_DBUS)
+IF(NOT WITHOUT_SYSTEMD)
+    ADD_DEFINITIONS(-DHAVE_SYSTEMD)
+ENDIF(NOT WITHOUT_SYSTEMD)
 
 ## Python packages directory ###################################################
 IF(NOT DEFINED PYTHON_SITELIB)
@@ -192,13 +190,17 @@ SET(VSM_UNIT_TESTS_IPC_SOCKET_PATH ${RUN_DIR}/vasum-ipc-unit-tests.socket)
 
 ADD_SUBDIRECTORY(${LOGGER_FOLDER})
 ADD_SUBDIRECTORY(${LXCPP_FOLDER})
+IF(NOT WITHOUT_DBUS)
 ADD_SUBDIRECTORY(${DBUS_FOLDER})
+ENDIF(NOT WITHOUT_DBUS)
 ADD_SUBDIRECTORY(${CONFIG_FOLDER})
 ADD_SUBDIRECTORY(${IPC_FOLDER})
 ADD_SUBDIRECTORY(${CLIENT_FOLDER})
 ADD_SUBDIRECTORY(${SERVER_FOLDER})
+IF(NOT WITHOUT_DBUS)
 ADD_SUBDIRECTORY(${ZONE_SUPPORT_FOLDER})
 ADD_SUBDIRECTORY(${ZONE_DAEMON_FOLDER})
+ENDIF(NOT WITHOUT_DBUS)
 ADD_SUBDIRECTORY(${TESTS_FOLDER})
 ADD_SUBDIRECTORY(${CLI_FOLDER})
 ADD_SUBDIRECTORY(${WRAPPER_FOLDER})
index 3fa44fd..f0d1828 100644 (file)
@@ -45,13 +45,16 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
 ## Link libraries ##############################################################
 FIND_PACKAGE(Boost COMPONENTS system filesystem)
 PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0)
-INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${IPC_FOLDER})
 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
-                      Config SimpleDbus Ipc)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES} Config Ipc)
+IF(NOT WITHOUT_DBUS)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} SimpleDbus)
+ENDIF(NOT WITHOUT_DBUS)
 
 ## Generate the pc file ########################################################
 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
index fcc5e23..160cb09 100644 (file)
@@ -38,7 +38,7 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
 
 ## Link libraries ##############################################################
 PKG_CHECK_MODULES(CONFIG_DEPS REQUIRED sqlite3 glib-2.0)
-PKG_SEARCH_MODULE(JSON_C json json-c)
+PKG_SEARCH_MODULE(JSON_C REQUIRED json json-c)
 
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(SYSTEM ${CONFIG_DEPS_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
index 8831ef6..74d309b 100644 (file)
 #include "config/is-visitable.hpp"
 #include "config/exception.hpp"
 
-#ifdef JSON_C_VERSION_NEW
-#include <json-c/json.h>
-#else //JSON_C_VERSION_NEW
-#include <json/json.h>
-#endif //JSON_C_VERSION_NEW
-
+#include <json.h>
 #include <string>
 #include <vector>
 
index 943dbb8..eea975c 100644 (file)
 #include "config/from-kvstore-visitor.hpp"
 #include "config/is-union.hpp"
 
-#ifdef JSON_C_VERSION_NEW
-#include <json-c/json.h>
-#else //JSON_C_VERSION_NEW
-#include <json/json.h>
-#endif //JSON_C_VERSION_NEW
+#include <json.h>
 
 namespace config {
 
index 1b68438..4ab4a4b 100644 (file)
 #include "config/is-visitable.hpp"
 #include "config/exception.hpp"
 
-#ifdef JSON_C_VERSION_NEW
-#include <json-c/json.h>
-#else //JSON_C_VERSION_NEW
-#include <json/json.h>
-#endif //JSON_C_VERSION_NEW
-
+#include <json.h>
 #include <string>
 #include <vector>
 
@@ -113,11 +108,11 @@ private:
 
     static json_object* toJsonObject(double value)
     {
-#ifdef JSON_C_VERSION_NEW
+#if JSON_C_MINOR_VERSION >= 12
         return json_object_new_double_s(value, std::to_string(value).c_str());
-#else //JSON_C_VERSION_NEW
+#else
         return json_object_new_double(value);
-#endif //JSON_C_VERSION_NEW
+#endif
     }
 
     static json_object* toJsonObject(const std::string& value)
index 84bb812..2fce8cb 100644 (file)
@@ -49,11 +49,13 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
     )
 
 ## Link libraries ##############################################################
+IF(NOT WITHOUT_SYSTEMD)
 PKG_CHECK_MODULES(IPC_DEPS REQUIRED libsystemd-daemon)
+ENDIF(NOT WITHOUT_SYSTEMD)
 
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
-INCLUDE_DIRECTORIES(SYSTEM ${DBUS_DEPS_INCLUDE_DIRS} ${IPC_DEPS_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${DBUS_DEPS_INCLUDE_DIRS} ${IPC_DEPS_INCLUDE_DIRS} ${CONFIG_DEPS_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${IPC_DEPS_LIBRARIES} Logger Config)
 
 ## Generate the pc file ########################################################
index 690bd43..1961a52 100644 (file)
@@ -30,7 +30,9 @@
 #include "utils/exception.hpp"
 #include "logger/logger.hpp"
 
+#ifdef HAVE_SYSTEMD
 #include <systemd/sd-daemon.h>
+#endif // HAVE_SYSTEMD
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/un.h>
@@ -112,6 +114,7 @@ void Socket::read(void* bufferPtr, const size_t size) const
     utils::read(mFD, bufferPtr, size);
 }
 
+#ifdef HAVE_SYSTEMD
 int Socket::getSystemdSocketInternal(const std::string& path)
 {
     int n = ::sd_listen_fds(-1 /*Block further calls to sd_listen_fds*/);
@@ -131,6 +134,7 @@ int Socket::getSystemdSocketInternal(const std::string& path)
     LOGW("No usable sockets were passed by systemd.");
     return -1;
 }
+#endif // HAVE_SYSTEMD
 
 int Socket::createSocketInternal(const std::string& path)
 {
@@ -178,7 +182,10 @@ int Socket::createSocketInternal(const std::string& path)
 Socket Socket::createSocket(const std::string& path)
 {
     // Initialize a socket
-    int fd = getSystemdSocketInternal(path);
+    int fd = -1;
+#ifdef HAVE_SYSTEMD
+    fd = getSystemdSocketInternal(path);
+#endif // HAVE_SYSTEMD
     fd = fd != -1 ? fd : createSocketInternal(path);
 
     return Socket(fd);
index d1e82eb..61027c2 100644 (file)
@@ -36,16 +36,14 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
 )
 
 ## Link libraries ##############################################################
-PKG_CHECK_MODULES(LOGGER_DEPS libsystemd-journal QUIET)
+IF(NOT WITHOUT_SYSTEMD)
+PKG_CHECK_MODULES(LOGGER_DEPS REQUIRED libsystemd-journal)
+ENDIF(NOT WITHOUT_SYSTEMD)
+
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(SYSTEM ${LOGGER_DEPS_INCLUDE_DIRS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${LOGGER_DEPS_LIBRARIES})
 
-## Add constants ###############################################################
-if(LOGGER_DEPS_FOUND)
-    ADD_DEFINITIONS(-DHAVE_SYSTEMD_JOURNAL=${LOGGER_DEPS_FOUND})
-endif()
-
 ## Generate the pc file ########################################################
 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
 
index af147cd..769e6d7 100644 (file)
@@ -21,7 +21,8 @@
  * @author  Dariusz Michaluk (d.michaluk@samsung.com)
  * @brief   Systemd journal backend for logger
  */
-#ifdef HAVE_SYSTEMD_JOURNAL
+
+#ifdef HAVE_SYSTEMD
 #include "logger/config.hpp"
 #include "logger/backend-journal.hpp"
 
@@ -69,4 +70,4 @@ void SystemdJournalBackend::log(LogLevel logLevel,
 }
 
 } // namespace logger
-#endif // HAVE_SYSTEMD_JOURNAL
+#endif // HAVE_SYSTEMD
index f1991d4..0ec93da 100644 (file)
 %define tty_group tty
 # Default platform is Tizen, setup Fedora with --define 'platform_type FEDORA'
 %{!?platform_type:%define platform_type "TIZEN"}
+# Default build with dbus
+%{!?without_dbus:%define without_dbus 0}
+# Default build with systemd
+%{!?without_systemd:%define without_systemd 0}
 
 Name:           vasum
 Epoch:          1
@@ -24,11 +28,18 @@ BuildRequires:  boost-devel
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  lxc-devel
 BuildRequires:  readline-devel
+BuildRequires:  pkgconfig(sqlite3)
 Requires:       lxc
+%if !%{without_systemd}
+BuildRequires:  pkgconfig(libsystemd-daemon)
+BuildRequires:  pkgconfig(libsystemd-journal)
+%endif
 %if %{platform_type} == "TIZEN"
+BuildRequires:  libjson-devel >= 0.10
 Requires:       iproute2
 Requires(post): libcap-tools
 %else
+BuildRequires:  json-c-devel
 Requires:       lxc-templates
 Requires:       iproute
 Requires(post): libcap
@@ -52,10 +63,14 @@ between them. A process from inside a zone can request a switch of context
 %config /etc/vasum/daemon.conf
 %attr(755,root,root) /etc/vasum/templates/*.sh
 %config /etc/vasum/templates/*.conf
+%if !%{without_systemd}
 %{_unitdir}/vasum.service
 %{_unitdir}/vasum.socket
 %{_unitdir}/multi-user.target.wants/vasum.service
+%endif
+%if !%{without_dbus}
 %config /etc/dbus-1/system.d/org.tizen.vasum.host.conf
+%endif
 %dir %{_datadir}/zones
 
 %prep
@@ -79,13 +94,16 @@ between them. A process from inside a zone can request a switch of context
          -DINPUT_EVENT_GROUP=%{input_event_group} \
          -DDISK_GROUP=%{disk_group} \
          -DTTY_GROUP=%{tty_group} \
-         -DWITHOUT_DBUS=%{?without_dbus}
+         -DWITHOUT_DBUS=%{?without_dbus} \
+         -DWITHOUT_SYSTEMD=%{?without_systemd}
 make -k %{?jobs:-j%jobs}
 
 %install
 %make_install
+%if !%{without_systemd}
 mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
 ln -s ../vasum.service %{buildroot}/%{_unitdir}/multi-user.target.wants/vasum.service
+%endif
 mkdir -p %{buildroot}/%{_datadir}/zones
 %if %{platform_type} == "TIZEN"
 ln -s tizen.conf %{buildroot}/etc/vasum/templates/default.conf
@@ -97,20 +115,26 @@ ln -s fedora.conf %{buildroot}/etc/vasum/templates/default.conf
 rm -rf %{buildroot}
 
 %post
+%if !%{without_systemd}
 # Refresh systemd services list after installation
 if [ $1 == 1 ]; then
     systemctl daemon-reload || :
 fi
+%endif
+
 # set needed caps on the binary to allow restart without loosing them
 setcap CAP_SYS_ADMIN,CAP_MAC_OVERRIDE,CAP_SYS_TTY_CONFIG+ei %{_bindir}/vasum-server
 
 %preun
+%if !%{without_systemd}
 # Stop the service before uninstall
 if [ $1 == 0 ]; then
      systemctl stop vasum.service || :
 fi
+%endif
 
 %postun
+%if !%{without_systemd}
 # Refresh systemd services list after uninstall/upgrade
 systemctl daemon-reload || :
 if [ $1 -ge 1 ]; then
@@ -123,6 +147,7 @@ if [ $1 -ge 1 ]; then
 else
     echo "Vasum removed. Reboot is required for the changes to take effect..."
 fi
+%endif
 
 ## Client Package ##############################################################
 %package client
@@ -172,7 +197,7 @@ Development package including the header files for the client library
 %{_libdir}/pkgconfig/vasum-client.pc
 %{_libdir}/pkgconfig/vasum.pc
 
-
+%if !%{without_dbus}
 ## Zone Support Package ###################################################
 %package zone-support
 Summary:          Vasum Support
@@ -205,7 +230,7 @@ Daemon running inside every zone.
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/vasum-zone-daemon
 %config /etc/dbus-1/system.d/org.tizen.vasum.zone.daemon.conf
-
+%endif
 
 ## Command Line Interface ######################################################
 %package cli
@@ -248,16 +273,22 @@ Requires:         boost-test
 Unit tests for both: server and client and integration tests.
 
 %post tests
-systemctl daemon-reload
-systemctl enable vasum-socket-test.socket
-systemctl start vasum-socket-test.socket
+%if !%{without_systemd}
+systemctl daemon-reload || :
+systemctl enable vasum-socket-test.socket || :
+systemctl start vasum-socket-test.socket || :
+%endif
 
 %preun tests
-systemctl stop vasum-socket-test.socket
-systemctl disable vasum-socket-test.socket
+%if !%{without_systemd}
+systemctl stop vasum-socket-test.socket || :
+systemctl disable vasum-socket-test.socket || :
+%endif
 
 %postun tests
-systemctl daemon-reload
+%if !%{without_systemd}
+systemctl daemon-reload || :
+%endif
 
 %files tests
 %if %{platform_type} == "TIZEN"
@@ -265,27 +296,32 @@ systemctl daemon-reload
 %endif
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/vasum-server-unit-tests
+%if !%{without_systemd}
 %attr(755,root,root) %{_bindir}/vasum-socket-test
+%endif
 %attr(755,root,root) %{script_dir}/vsm_all_tests.py
 %attr(755,root,root) %{script_dir}/vsm_int_tests.py
 %attr(755,root,root) %{script_dir}/vsm_launch_test.py
 %{script_dir}/vsm_test_parser.py
 %config /etc/vasum/tests/*.conf
+%if !%{without_dbus}
 %config /etc/vasum/tests/dbus/*.conf
+%config /etc/dbus-1/system.d/org.tizen.vasum.tests.conf
+%endif
 %config /etc/vasum/tests/provision/*.conf
 %config /etc/vasum/tests/templates/*.conf
 %attr(755,root,root) /etc/vasum/tests/templates/*.sh
 %config /etc/vasum/tests/utils/*.txt
 %{python_sitelib}/vsm_integration_tests
-%config /etc/dbus-1/system.d/org.tizen.vasum.tests.conf
+%if !%{without_systemd}
 %{_unitdir}/vasum-socket-test.socket
 %{_unitdir}/vasum-socket-test.service
+%endif
 
 ## libLogger Package ###########################################################
 %package -n libLogger
 Summary:            Logger library
 Group:              Security/Other
-BuildRequires:      pkgconfig(libsystemd-journal)
 Requires(post):     /sbin/ldconfig
 Requires(postun):   /sbin/ldconfig
 
@@ -315,6 +351,7 @@ The package provides libLogger development tools and libs.
 %{_includedir}/vasum-tools/logger
 %{_libdir}/pkgconfig/libLogger.pc
 
+%if !%{without_dbus}
 ## libSimpleDbus Package #######################################################
 %package -n libSimpleDbus
 Summary:            Simple dbus library
@@ -348,17 +385,15 @@ The package provides libSimpleDbus development tools and libs.
 %{_libdir}/libSimpleDbus.so
 %{_includedir}/vasum-tools/dbus
 %{_libdir}/pkgconfig/libSimpleDbus.pc
+%endif
 
 ## libConfig Package ##########################################################
 %package -n libConfig
 Summary:            Config library
 Group:              Security/Other
-BuildRequires:      pkgconfig(sqlite3)
 %if %{platform_type} == "TIZEN"
-BuildRequires:      libjson-devel >= 0.10
 Requires:           libjson >= 0.10
 %else
-BuildRequires:      json-c-devel
 Requires:           json-c
 %endif
 Requires(post):     /sbin/ldconfig
@@ -401,7 +436,6 @@ The package provides libConfig development tools and libs.
 %package -n libIpc
 Summary:            IPC library
 Group:              Security/Other
-BuildRequires:      pkgconfig(libsystemd-daemon)
 Requires:           libConfig
 Requires(post):     /sbin/ldconfig
 Requires(postun):   /sbin/ldconfig
index b301d00..58c50f6 100644 (file)
@@ -35,7 +35,7 @@ PKG_CHECK_MODULES(SERVER_DEPS REQUIRED lxc glib-2.0 gio-2.0)
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
-INCLUDE_DIRECTORIES(SYSTEM ${SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
 
 SET_TARGET_PROPERTIES(${SERVER_CODENAME} PROPERTIES
     COMPILE_FLAGS "-pthread"
@@ -43,8 +43,10 @@ SET_TARGET_PROPERTIES(${SERVER_CODENAME} PROPERTIES
     LINK_FLAGS "-pthread"
 )
 
-TARGET_LINK_LIBRARIES(${SERVER_CODENAME} ${SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
-                      Logger Config SimpleDbus Ipc)
+TARGET_LINK_LIBRARIES(${SERVER_CODENAME} ${SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES} Logger Config Ipc)
+IF(NOT WITHOUT_DBUS)
+TARGET_LINK_LIBRARIES(${SERVER_CODENAME} SimpleDbus)
+ENDIF(NOT WITHOUT_DBUS)
 
 ## Subdirectories ##############################################################
 ADD_SUBDIRECTORY(configs)
index 09254a5..c91b3e4 100644 (file)
@@ -23,25 +23,29 @@ FILE(GLOB zone_templates_CONF  templates/*.conf)
 FILE(GLOB lxc_templates_CONF   templates/*.sh)
 
 ## Generate ####################################################################
+IF(NOT WITHOUT_SYSTEMD)
 CONFIGURE_FILE(systemd/vasum.service.in
                ${CMAKE_BINARY_DIR}/systemd/vasum.service)
 CONFIGURE_FILE(systemd/vasum.socket.in
                ${CMAKE_BINARY_DIR}/systemd/vasum.socket)
+ENDIF(NOT WITHOUT_SYSTEMD)
 
-
-## Install #####################################################################
 CONFIGURE_FILE(daemon.conf.in
                ${CMAKE_BINARY_DIR}/daemon.conf)
 
-INSTALL(FILES       ${CMAKE_BINARY_DIR}/daemon.conf
-        DESTINATION ${VSM_CONFIG_INSTALL_DIR})
-
-# preprocess d-bus configs
+IF(NOT WITHOUT_DBUS)
 CONFIGURE_FILE(dbus-1/system.d/org.tizen.vasum.host.conf.in
                ${CMAKE_BINARY_DIR}/dbus-1/system.d/org.tizen.vasum.host.conf)
+ENDIF(NOT WITHOUT_DBUS)
 
+## Install #####################################################################
+INSTALL(FILES       ${CMAKE_BINARY_DIR}/daemon.conf
+        DESTINATION ${VSM_CONFIG_INSTALL_DIR})
+
+IF(NOT WITHOUT_DBUS)
 INSTALL(FILES       ${CMAKE_BINARY_DIR}/dbus-1/system.d/org.tizen.vasum.host.conf
         DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
+ENDIF(NOT WITHOUT_DBUS)
 
 INSTALL(DIRECTORY   DESTINATION ${DATA_DIR}/zones)
 
@@ -51,7 +55,10 @@ INSTALL(FILES       ${zone_templates_CONF}
 INSTALL(PROGRAMS    ${lxc_templates_CONF}
         DESTINATION ${VSM_CONFIG_INSTALL_DIR}/templates)
 
+IF(NOT WITHOUT_SYSTEMD)
 INSTALL(FILES
         ${CMAKE_BINARY_DIR}/systemd/vasum.service
         ${CMAKE_BINARY_DIR}/systemd/vasum.socket
         DESTINATION ${SYSTEMD_UNIT_DIR})
+ENDIF(NOT WITHOUT_SYSTEMD)
+
diff --git a/server/configs/templates/ubuntu.conf b/server/configs/templates/ubuntu.conf
new file mode 100644 (file)
index 0000000..baa9a75
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    "zoneTemplate" : "ubuntu.sh",
+    "initWithArgs" : [],
+    "requestedState" : "stopped",
+    "ipv4Gateway" : "",
+    "ipv4" : "",
+    "cpuQuotaForeground" : -1,
+    "cpuQuotaBackground" : 1000,
+    "privilege" : 10,
+    "vt" : -1,
+    "shutdownTimeout" : 10,
+    "switchToDefaultAfterTimeout" : true,
+    "runMountPoint" : "~NAME~/run",
+    "provisions" : [],
+    "validLinkPrefixes" : [ "/tmp/",
+                            "/run/",
+                            "/opt/usr/data/",
+                            "/opt/usr/dbsapce/" ]
+}
diff --git a/server/configs/templates/ubuntu.sh b/server/configs/templates/ubuntu.sh
new file mode 100755 (executable)
index 0000000..edcf649
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+#  template script for creating Ubuntu LXC container
+#  This script is a wrapper for the lxc-ubuntu template
+#
+#  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Contact: Dariusz Michaluk  <d.michaluk@samsung.com>
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+usage()
+{
+    cat <<EOF
+usage:
+    $1 -n|--name=<zone_name>
+        [-p|--path=<path>] [--rootfs=<rootfs>] [--vt=<vt>]
+        [--ipv4=<ipv4>] [--ipv4-gateway=<ipv4_gateway>] [-h|--help]
+Mandatory args:
+  -n,--name         zone name
+  -p,--path         path to zone config files
+  --rootfs          path to zone rootfs
+Optional args:
+  --vt              zone virtual terminal
+  --ipv4            zone IP address
+  --ipv4-gateway    zone gateway
+  -h,--help         print help
+EOF
+    return 0
+}
+
+options=$(getopt -o hp:n: -l help,rootfs:,path:,vt:,name:,ipv4:,ipv4-gateway: -- "$@")
+if [ $? -ne 0 ]; then
+    usage $(basename $0)
+    exit 1
+fi
+eval set -- "$options"
+
+while true
+do
+    case "$1" in
+        -h|--help)      usage $0 && exit 0;;
+        --rootfs)       rootfs=$2; shift 2;;
+        -p|--path)      path=$2; shift 2;;
+        --vt)           vt=$2; shift 2;;
+        -n|--name)      name=$2; shift 2;;
+        --ipv4)         ipv4=$2; shift 2;;
+        --ipv4-gateway) ipv4_gateway=$2; shift 2;;
+        --)             shift 1; break ;;
+        *)              break ;;
+    esac
+done
+
+if [ "$(id -u)" != "0" ]; then
+    echo "This script should be run as 'root'"
+    exit 1
+fi
+
+if [ -z $name ]; then
+    echo "Zone name must be given"
+    exit 1
+fi
+
+if [ -z "$path" ]; then
+    echo "'path' parameter is required"
+    exit 1
+fi
+
+if [ -z "$rootfs" ]; then
+    echo "'rootfs' parameter is required"
+    exit 1
+fi
+
+/usr/share/lxc/templates/lxc-ubuntu --name="$name" --path="$path" --rootfs="$rootfs"
index 90a248b..1229acb 100644 (file)
@@ -22,6 +22,7 @@
  * @brief   Implementation of a class for communication with server
  */
 
+#ifdef DBUS_CONNECTION
 #include "config.hpp"
 
 #include "host-dbus-connection.hpp"
@@ -447,3 +448,4 @@ void HostDbusConnection::proxyCallAsync(const std::string& busName,
 }
 
 } // namespace vasum
+#endif //DBUS_CONNECTION
index fafa788..707eb50 100644 (file)
@@ -36,6 +36,7 @@
 #include "logger/logger.hpp"
 #include "logger/backend-stderr.hpp"
 #include "logger/backend-journal.hpp"
+#include "logger/backend-syslog.hpp"
 #include "utils/typeinfo.hpp"
 #include "utils/signal.hpp"
 
@@ -110,8 +111,10 @@ int main(int argc, char* argv[])
         Logger::setLogLevel(vm["log-level"].as<std::string>());
 #ifdef LOG_TO_CONSOLE
         Logger::setLogBackend(new StderrBackend());
-#else
+#elif HAVE_SYSTEMD
         Logger::setLogBackend(new SystemdJournalBackend());
+#else
+        Logger::setLogBackend(new SyslogBackend());
 #endif
 
         runAsRoot = vm.count("root") > 0;
index 46a9a3b..aa652c7 100644 (file)
@@ -34,15 +34,17 @@ LIST(REMOVE_ITEM project_SRCS ${socket_test_SRCS})
 
 ## Setup target ################################################################
 SET(UT_SERVER_CODENAME "${PROJECT_NAME}-server-unit-tests")
-SET(SOCKET_TEST_CODENAME "${PROJECT_NAME}-socket-test")
 ADD_EXECUTABLE(${UT_SERVER_CODENAME} ${project_SRCS} ${common_SRCS} ${server_SRCS} ${client_SRCS})
 
 ## A fake target to test vasum-client C API
 ADD_EXECUTABLE("vasum-client-c-api-compile-test" client/client-c-api-compile-test.c)
 
+IF(NOT WITHOUT_SYSTEMD)
+SET(SOCKET_TEST_CODENAME "${PROJECT_NAME}-socket-test")
+
 ## A stub mini-service to test socket functionality
 ADD_EXECUTABLE(${SOCKET_TEST_CODENAME} ${socket_test_SRCS} ${common_SRCS} ${client_SRCS})
-
+ENDIF(NOT WITHOUT_SYSTEMD)
 
 ## Link libraries ##############################################################
 FIND_PACKAGE (Boost COMPONENTS unit_test_framework system filesystem regex)
@@ -50,7 +52,7 @@ FIND_PACKAGE (Boost COMPONENTS unit_test_framework system filesystem regex)
 PKG_CHECK_MODULES(UT_SERVER_DEPS REQUIRED lxc gio-2.0)
 INCLUDE_DIRECTORIES(${COMMON_FOLDER} ${SERVER_FOLDER} ${UNIT_TESTS_FOLDER} ${CLIENT_FOLDER}
                     ${LIBS_FOLDER} ${SOCKET_TEST_FOLDER})
-INCLUDE_DIRECTORIES(SYSTEM ${UT_SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${UT_SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
 
 SET_TARGET_PROPERTIES(${UT_SERVER_CODENAME} PROPERTIES
     COMPILE_FLAGS "-pthread"
@@ -58,16 +60,26 @@ SET_TARGET_PROPERTIES(${UT_SERVER_CODENAME} PROPERTIES
     LINK_FLAGS "-pthread"
 )
 
+TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
+                      Logger Config Ipc)
+IF(NOT WITHOUT_DBUS)
+TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} SimpleDbus)
+ENDIF(NOT WITHOUT_DBUS)
+
+IF(NOT WITHOUT_SYSTEMD)
 SET_TARGET_PROPERTIES(${SOCKET_TEST_CODENAME} PROPERTIES
     COMPILE_FLAGS "-pthread"
     COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_UNIT_TESTS_IPC_SOCKET_PATH}"
     LINK_FLAGS "-pthread"
 )
 
-TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
-                      Logger Config SimpleDbus Ipc)
 TARGET_LINK_LIBRARIES(${SOCKET_TEST_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
-                      Logger Config SimpleDbus Ipc)
+                      Logger Config Ipc)
+IF(NOT WITHOUT_DBUS)
+TARGET_LINK_LIBRARIES(${SOCKET_TEST_CODENAME} SimpleDbus)
+ENDIF(NOT WITHOUT_DBUS)
+
+ENDIF(NOT WITHOUT_SYSTEMD)
 
 ## Subdirectories ##############################################################
 SET(VSM_TEST_CONFIG_INSTALL_DIR ${VSM_CONFIG_INSTALL_DIR}/tests)
@@ -79,4 +91,8 @@ ADD_SUBDIRECTORY(configs)
 
 ## Install #####################################################################
 INSTALL(TARGETS ${UT_SERVER_CODENAME} DESTINATION bin)
+
+IF(NOT WITHOUT_SYSTEMD)
 INSTALL(TARGETS ${SOCKET_TEST_CODENAME} DESTINATION bin)
+ENDIF(NOT WITHOUT_SYSTEMD)
+
index 6bffac4..a6fcbac 100644 (file)
@@ -28,15 +28,18 @@ CONFIGURE_FILE(test-daemon.conf.in
               ${CMAKE_BINARY_DIR}/test-daemon.conf @ONLY)
 FILE(GLOB ut_zone_CONF_GEN ${CMAKE_BINARY_DIR}/*.conf)
 
+IF(NOT WITHOUT_DBUS)
 CONFIGURE_FILE(templates/console-dbus.conf.in
                ${CMAKE_BINARY_DIR}/templates/console-dbus.conf @ONLY)
+ENDIF(NOT WITHOUT_DBUS)
 CONFIGURE_FILE(templates/console-ipc.conf.in
                ${CMAKE_BINARY_DIR}/templates/console-ipc.conf @ONLY)
 FILE(GLOB ut_zone_templates_CONF_GEN ${CMAKE_BINARY_DIR}/templates/*.conf)
 
+IF(NOT WITHOUT_SYSTEMD)
 CONFIGURE_FILE(systemd/vasum-socket-test.service.in
                ${CMAKE_BINARY_DIR}/systemd/vasum-socket-test.service)
-
+ENDIF(NOT WITHOUT_SYSTEMD)
 
 ## Install #####################################################################
 INSTALL(FILES        ${ut_zone_CONF}
@@ -50,9 +53,11 @@ INSTALL(FILES        ${ut_zone_templates_CONF}
 INSTALL(PROGRAMS     ${ut_lxc_templates_CONF}
         DESTINATION  ${VSM_TEST_TEMPLATES_INSTALL_DIR})
 
+IF(NOT WITHOUT_DBUS)
 INSTALL(FILES        dbus/ut-dbus.conf
                      dbus/ut-dbus-system.conf
         DESTINATION  ${VSM_TEST_CONFIG_INSTALL_DIR}/dbus)
+ENDIF(NOT WITHOUT_DBUS)
 
 INSTALL(FILES        provision/test-provision.conf
         DESTINATION  ${VSM_TEST_CONFIG_INSTALL_DIR}/provision)
@@ -60,10 +65,14 @@ INSTALL(FILES        provision/test-provision.conf
 INSTALL(FILES        utils/file.txt
         DESTINATION  ${VSM_TEST_CONFIG_INSTALL_DIR}/utils)
 
+
+IF(NOT WITHOUT_SYSTEMD)
 INSTALL(FILES        systemd/vasum-socket-test.socket
                      ${CMAKE_BINARY_DIR}/systemd/vasum-socket-test.service
         DESTINATION  ${SYSTEMD_UNIT_DIR})
+ENDIF(NOT WITHOUT_SYSTEMD)
 
+IF(NOT WITHOUT_DBUS)
 INSTALL(FILES        dbus-1/system.d/org.tizen.vasum.tests.conf
         DESTINATION  ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
-
+ENDIF(NOT WITHOUT_DBUS)
index 23b77a6..2ce4024 100644 (file)
@@ -1,6 +1,6 @@
 {
     "zoneTemplate" : "/buggy/path",
-    "initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
+    "initWithArgs" : ["/bin/bash", "-c", "trap exit SIGTERM; read"],
     "requestedState" : "running",
     "ipv4Gateway" : "",
     "ipv4" : "",
index 4daff1d..1ef567f 100644 (file)
@@ -1,6 +1,6 @@
 {
     "zoneTemplate" : "minimal.sh",
-    "initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; /usr/bin/dbus-daemon --config-file=@VSM_TEST_CONFIG_INSTALL_DIR@/dbus/ut-dbus-system.conf --fork; read"],
+    "initWithArgs" : ["/bin/bash", "-c", "trap exit SIGTERM; /bin/dbus-daemon --config-file=@VSM_TEST_CONFIG_INSTALL_DIR@/dbus/ut-dbus-system.conf --fork; read"],
     "requestedState" : "running",
     "ipv4Gateway" : "",
     "ipv4" : "",
index cefd3e7..dce9410 100644 (file)
@@ -1,6 +1,6 @@
 {
     "zoneTemplate" : "minimal.sh",
-    "initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
+    "initWithArgs" : ["/bin/bash", "-c", "trap exit SIGTERM; read"],
     "requestedState" : "running",
     "ipv4Gateway" : "",
     "ipv4" : "",
index cd9ae0b..276adc9 100644 (file)
@@ -1,6 +1,6 @@
 {
     "zoneTemplate" : "minimal.sh",
-    "initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
+    "initWithArgs" : ["/bin/bash", "-c", "trap exit SIGTERM; read"],
     "requestedState" : "running",
     "ipv4Gateway" : "",
     "ipv4" : "",
index 1d19915..4d5abd6 100644 (file)
@@ -1,6 +1,6 @@
 {
     "zoneTemplate" : "missing.sh",
-    "initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
+    "initWithArgs" : ["/bin/bash", "-c", "trap exit SIGTERM; read"],
     "requestedState" : "running",
     "ipv4Gateway" : "",
     "ipv4" : "",
index f8ab796..026c3e7 100644 (file)
@@ -1,6 +1,6 @@
 {
     "zoneTemplate" : "minimal.sh",
-    "initWithArgs" : ["/bin/sh"],
+    "initWithArgs" : ["/bin/bash"],
     "requestedState" : "running",
     "ipv4Gateway" : "",
     "ipv4" : "",
index f1a9c25..eb6b6fe 100644 (file)
@@ -22,6 +22,7 @@
  * @brief   Example dbus api client
  */
 
+#ifdef DBUS_CONNECTION
 #include "config.hpp"
 
 #include "dbus/test-client.hpp"
@@ -101,3 +102,4 @@ void DbusTestClient::throwException(int arg)
 
 
 } // namespace vasum
+#endif //DBUS_CONNECTION
index 03a4046..1d9fd43 100644 (file)
@@ -22,6 +22,7 @@
  * @brief   Example dbus api server
  */
 
+#ifdef DBUS_CONNECTION
 #include "config.hpp"
 
 #include "dbus/test-server.hpp"
@@ -149,3 +150,4 @@ void DbusTestServer::onMessageCall(const std::string& objectPath,
 
 
 } // namespace vasum
+#endif //DBUS_CONNECTION
index 6cefb1c..cfc5efd 100644 (file)
@@ -22,6 +22,7 @@
  * @brief   Dbus connection unit tests
  */
 
+#ifdef DBUS_CONNECTION
 #include "config.hpp"
 #include "ut.hpp"
 #include "dbus/test-server.hpp"
@@ -52,7 +53,7 @@ using namespace dbus;
 
 namespace {
 
-const char* DBUS_DAEMON_PROC = "/usr/bin/dbus-daemon";
+const char* DBUS_DAEMON_PROC = "/bin/dbus-daemon";
 const char* const DBUS_DAEMON_ARGS[] = {
     DBUS_DAEMON_PROC,
     "--config-file=" VSM_TEST_CONFIG_INSTALL_DIR "/dbus/ut-dbus.conf",
@@ -642,3 +643,4 @@ BOOST_AUTO_TEST_CASE(DbusApiConnectionLostDelayedCallbackSet)
 }
 
 BOOST_AUTO_TEST_SUITE_END()
+#endif //DBUS_CONNECTION
index 1aacd22..d2337d1 100644 (file)
@@ -22,6 +22,7 @@
  * @brief   Socket IPC module tests
  */
 
+#ifdef HAVE_SYSTEMD
 #include "config.hpp"
 #include "ut.hpp"
 #include "ipc/internals/socket.hpp"
@@ -47,3 +48,4 @@ BOOST_AUTO_TEST_CASE(SystemdSocket)
 }
 
 BOOST_AUTO_TEST_SUITE_END()
+#endif // HAVE_SYSTEMD
index ba839c9..6702773 100644 (file)
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(StartShutdown)
     LxcZone lxc(ZONE_PATH, ZONE_NAME);
     BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED);
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         "-c",
         "trap exit SIGTERM; read",
         NULL
@@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(StartStop)
     LxcZone lxc(ZONE_PATH, ZONE_NAME);
     BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED);
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         NULL
     };
     BOOST_CHECK(lxc.start(argv));
@@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE(StartHasStopped)
     LxcZone lxc(ZONE_PATH, ZONE_NAME);
     BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED);
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         "-c",
         "echo",
         NULL
@@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE(FreezeUnfreeze)
     LxcZone lxc(ZONE_PATH, ZONE_NAME);
     BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         "-c",
         "trap exit SIGTERM; read",
         NULL
@@ -200,7 +200,7 @@ BOOST_AUTO_TEST_CASE(FreezeStop)
     LxcZone lxc(ZONE_PATH, ZONE_NAME);
     BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         "-c",
         "trap exit SIGTERM; read",
         NULL
@@ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE(Repeat)
     BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
     BOOST_CHECK(!lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));// forbidden
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         "-c",
         "trap exit SIGTERM; read",
         NULL
@@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE(CreateFile)
     LxcZone lxc(ZONE_PATH, ZONE_NAME);
     BOOST_REQUIRE(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
     const char* argv[] = {
-        "/bin/sh",
+        "/bin/bash",
         "-c",
         "trap exit SIGTERM; read",
         NULL
index 1da6190..e492c37 100644 (file)
@@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(ForegroundBackgroundSchedulerLevel)
     c->setSchedulerLevel(SchedulerLevel::BACKGROUND);
     BOOST_CHECK_EQUAL(c->getSchedulerQuota(), refConfig.cpuQuotaBackground);
 }
-
+#ifdef DBUS_CONNECTION
 BOOST_AUTO_TEST_CASE(DbusConnection)
 {
     mRunGuard.create("/tmp/ut-run"); // the same path as in zone template
@@ -230,6 +230,7 @@ BOOST_AUTO_TEST_CASE(DbusConnection)
 }
 
 // TODO: DbusReconnection
+#endif //DBUS_CONNECTION
 
 BOOST_AUTO_TEST_CASE(ListNetdev)
 {
index 23fdba6..3346df8 100644 (file)
@@ -53,13 +53,16 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
 ## Link libraries ##############################################################
 FIND_PACKAGE(Boost COMPONENTS system filesystem)
 PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0)
-INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
-                      Config SimpleDbus Ipc)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES} Config Ipc)
+IF(NOT WITHOUT_DBUS)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} SimpleDbus)
+ENDIF(NOT WITHOUT_DBUS)
 
 ## Generate the pc file ########################################################
 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
index f0c00c6..0cfe21f 100644 (file)
@@ -36,6 +36,7 @@
 #include "logger/logger.hpp"
 #include "logger/backend-stderr.hpp"
 #include "logger/backend-journal.hpp"
+#include "logger/backend-syslog.hpp"
 #include "utils/typeinfo.hpp"
 
 #include <boost/program_options.hpp>
@@ -100,11 +101,12 @@ int main(int argc, char* argv[])
         Logger::setLogLevel(vm["log-level"].as<std::string>());
 #ifdef LOG_TO_CONSOLE
         Logger::setLogBackend(new StderrBackend());
-#else
+#elif HAVE_SYSTEMD
         Logger::setLogBackend(new SystemdJournalBackend());
+#else
+        Logger::setLogBackend(new SyslogBackend());
 #endif
 
-
     } catch (std::exception& e) {
         std::cerr << e.what() << std::endl;
         return 1;