Start bt-service with systemd user with multi-user option 95/8495/2 submit/tizen/20130822.094138
authorVictor Hakoun <victor.hakoun@eurogiciel.fr>
Wed, 21 Aug 2013 09:26:59 +0000 (11:26 +0200)
committerVictor Hakoun <victor.hakoun@eurogiciel.fr>
Wed, 21 Aug 2013 09:26:59 +0000 (11:26 +0200)
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 <victor.hakoun@eurogiciel.fr>
CMakeLists.txt
bt-service/CMakeLists.txt
bt-service/bluetooth-frwk-service.service
bt-service/bluetooth-frwk-service_user.conf [new file with mode: 0644]
packaging/bluetooth-frwk.changes
packaging/bluetooth-frwk.spec

index 10f10b3..3f82e79 100644 (file)
@@ -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)
 
index cf97128..fb2df17 100644 (file)
@@ -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})
 
index 232edfd..55c4065 100644 (file)
@@ -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 (file)
index 0000000..ff102d6
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+    <policy context="default">
+        <allow own="org.projectx.bt"/>
+        <allow own="org.projectx.bt_event"/>
+    </policy>
+    <policy at_console="true">
+        <allow send_destination="org.projectx.bt"/>
+    </policy>
+    <policy context="default">
+        <allow send_destination="org.projectx.bt"/>
+    </policy>
+</busconfig>
+
index 7d2e8b9..cce88a5 100644 (file)
@@ -1,3 +1,6 @@
+* Wed Aug 21 2013 Victor Hakoun <victor.hakoun@eurogiciel.fr> submit/tizen/20130809.082724@2a3c24d
+- Start bt-service with systemd user with multi-user option
+
 * Fri Aug 09 2013 Victor Hakoun <victor.hakoun@eurogiciel.fr> 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.
 
index 174f905..d6d6fb7 100644 (file)
@@ -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