From 2304f1c6bdc00a7db00eed1d325c061d7fd4f611 Mon Sep 17 00:00:00 2001 From: Victor Hakoun Date: Wed, 21 Aug 2013 11:26:59 +0200 Subject: [PATCH] Start bt-service with systemd user with multi-user option In multi-user environment bt-service cannot be launch by dbus-activation or systemd-dbus activation. - Add bcond_with multi-user option - Add MULTI_USER_SUPPORT build option - Remove rc.d/init.d in multi-user environment because done with systemd user and bluetooth-frwk-service scprit is for app user. - Change dbus policy for multi-user - Fix systemd unit file Install section - Fix TZPC-4380 Signed-off-by: Victor Hakoun --- CMakeLists.txt | 4 ++++ bt-service/CMakeLists.txt | 13 +++++++++++-- bt-service/bluetooth-frwk-service.service | 2 +- bt-service/bluetooth-frwk-service_user.conf | 15 +++++++++++++++ packaging/bluetooth-frwk.changes | 3 +++ packaging/bluetooth-frwk.spec | 29 ++++++++++++++++++++--------- 6 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 bt-service/bluetooth-frwk-service_user.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 10f10b3..3f82e79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,10 @@ OPTION(LIBNOTIFY_SUPPORT "Enable libnotify for popup" Off) IF(LIBNOTIFY_SUPPORT) ADD_DEFINITIONS("-DLIBNOTIFY_SUPPORT") ENDIF(LIBNOTIFY_SUPPORT) +OPTION(MULTI_USER_SUPPORT "Enable multi-user support" OFF) +IF(MULTI_USER_SUPPORT) + ADD_DEFINITIONS("-DMULTI_USER_SUPPORT") +ENDIF(MULTI_USER_SUPPORT) ADD_SUBDIRECTORY(bt-api) diff --git a/bt-service/CMakeLists.txt b/bt-service/CMakeLists.txt index cf97128..fb2df17 100644 --- a/bt-service/CMakeLists.txt +++ b/bt-service/CMakeLists.txt @@ -97,15 +97,24 @@ ELSE(LIBNOTIFY_SUPPORT) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS}) ENDIF(LIBNOTIFY_SUPPORT) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service DESTINATION share/dbus-1/system-services) + +IF(NOT MULTI_USER_SUPPORT) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service DESTINATION share/dbus-1/system-services) +ENDIF(MULTI_USER_SUPPORT) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/auto-pair-blacklist DESTINATION /opt/var/lib/bluetooth) # install booting script +IF(NOT MULTI_USER_SUPPORT) INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service DESTINATION /etc/rc.d/init.d) +ENDIF(MULTI_USER_SUPPORT) -install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d) +IF(MULTI_USER_SUPPORT) + install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service_user.conf DESTINATION /etc/dbus-1/system.d) +ELSE(MULTI_USER_SUPPORT) + install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d) +ENDIF(MULTI_USER_SUPPORT) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) diff --git a/bt-service/bluetooth-frwk-service.service b/bt-service/bluetooth-frwk-service.service index 232edfd..55c4065 100644 --- a/bt-service/bluetooth-frwk-service.service +++ b/bt-service/bluetooth-frwk-service.service @@ -10,4 +10,4 @@ ExecStart=/usr/bin/bt-service RemainAfterExit=yes [Install] -WantedBy=tizen-middleware.target.wants +WantedBy=tizen-middleware.target diff --git a/bt-service/bluetooth-frwk-service_user.conf b/bt-service/bluetooth-frwk-service_user.conf new file mode 100644 index 0000000..ff102d6 --- /dev/null +++ b/bt-service/bluetooth-frwk-service_user.conf @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/packaging/bluetooth-frwk.changes b/packaging/bluetooth-frwk.changes index 7d2e8b9..cce88a5 100644 --- a/packaging/bluetooth-frwk.changes +++ b/packaging/bluetooth-frwk.changes @@ -1,3 +1,6 @@ +* Wed Aug 21 2013 Victor Hakoun submit/tizen/20130809.082724@2a3c24d +- Start bt-service with systemd user with multi-user option + * Fri Aug 09 2013 Victor Hakoun submit/tizen/20130809.031242@26a0212 - Add a libnotify/gtk popup system to bluetooth-frwk. This is helping having Bluetooth popups with no OSP application dependencies (bt-syspopup and osp-launcher) and gtk/libnotify on the patform. diff --git a/packaging/bluetooth-frwk.spec b/packaging/bluetooth-frwk.spec index 174f905..d6d6fb7 100644 --- a/packaging/bluetooth-frwk.spec +++ b/packaging/bluetooth-frwk.spec @@ -1,4 +1,5 @@ %bcond_with bluetooth_frwk_libnotify +%bcond_with multi_user Name: bluetooth-frwk Summary: Bluetooth framework for BlueZ and Obexd Version: 0.2.57 @@ -84,6 +85,11 @@ export CFLAGS+=" -fpie" export LDFLAGS+=" -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" %endif %cmake . \ +%if %{with multi_user} + -DMULTI_USER_SUPPORT=On \ +%else + -DMULTI_USER_SUPPORT=Off \ +%endif %if %{with bluetooth_frwk_libnotify} -DLIBNOTIFY_SUPPORT=On %else @@ -95,11 +101,14 @@ make %install rm -rf %{buildroot} %make_install - -mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/ -mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/ -ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-service -ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-service +%if !%{with multi_user} + mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/ + mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/ + ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-service + ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-service +%else + mv %{buildroot}%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service_user.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf +%endif mkdir -p %{buildroot}%{_unitdir_user} mkdir -p %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants @@ -140,10 +149,12 @@ vconftool set -tf int memory/bluetooth/btsco "0" -g 6520 -i %files service %manifest %{name}.manifest %defattr(-, root, root) -%{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service -%{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-service -%{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-service -%{_datadir}/dbus-1/system-services/org.projectx.bt.service +%if !%{with multi_user} + %{_datadir}/dbus-1/system-services/org.projectx.bt.service + %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service + %{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-service + %{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-service +%endif %{_bindir}/bt-service %{_unitdir_user}/tizen-middleware.target.wants/bluetooth-frwk-service.service %{_unitdir_user}/bluetooth-frwk-service.service -- 2.7.4