fix obex systemd service to support multiuser 15/26215/2 accepted/tizen/ivi/20140902.081022 submit/tizen/20140822.031654
authortony <tony@tony-OptiPlex-790.(none)>
Tue, 19 Aug 2014 09:01:52 +0000 (17:01 +0800)
committerchunqiangx <chunqiangx.tang@intel.com>
Wed, 20 Aug 2014 03:09:14 +0000 (11:09 +0800)
This created obex root directory before runing obexd
if the directory does not exist.
Adding a shell script to handle this.

Bug-Tizen: TC-1436

Change-Id: I84d678b738c1ebca8966f4bbe123004a4d38e9bb
Signed-off-by: chunqiangx <chunqiangx.tang@intel.com>
obexd/src/obex.service.in
packaging/bluez.spec
packaging/obex.sh [new file with mode: 0755]

index b381be2..217d7ab 100644 (file)
@@ -4,8 +4,7 @@ Description=Bluetooth OBEX service
 [Service]
 Type=dbus
 BusName=org.bluez.obex
-ExecStartPre=/bin/sh -c 'if [ ! -d $HOME/content ] ; then /bin/mkdir -p $HOME/content ; fi'
-ExecStart=/bin/sh -c 'if [ -z `ps ax | grep -v grep | grep obexd` ] ; then exec /lib/bluetooth/obexd -d --noplugin=syncevolution,pcsuite,irmc --symlinks --root=$HOME/content ; fi'
+ExecStart=/bin/obex.sh
 
 [Install]
 Alias=dbus-org.bluez.obex.service
index 43e64b6..e251d9d 100644 (file)
@@ -34,6 +34,7 @@ Source5:        baselibs.conf
 Source7:        bluetooth.modprobe
 Source101:      obex-root-setup
 Source102:      create-symlinks
+Source103:      obex.sh
 Source1001:     bluez.manifest
 
 %define cups_lib_dir %{_prefix}/lib/cups
@@ -129,6 +130,7 @@ install --mode 0755 -d $RPM_BUILD_ROOT/var/lib/bluetooth
 
 install -D -m 0755 %SOURCE101 %{buildroot}%{_bindir}/obex-root-setup
 install -D -m 0755 %SOURCE102 %{buildroot}%{_sysconfdir}/obex/root-setup.d/000_create-symlinks
+install -D -m 0755 %SOURCE103 %{buildroot}%{_bindir}/obex.sh
 install -D -m 0755 tools/btiotest $RPM_BUILD_ROOT/%{_bindir}/
 install -D -m 0755 tools/bluetooth-player $RPM_BUILD_ROOT/%{_bindir}/
 install -D -m 0755 tools/mpris-player $RPM_BUILD_ROOT/%{_bindir}/
@@ -195,6 +197,7 @@ install -D -m 0755 tools/obexctl %{buildroot}%{_bindir}/obexctl
 %{_datadir}/dbus-1/services/org.bluez.obex.service
 %{_sysconfdir}/obex/root-setup.d/000_create-symlinks
 %{_bindir}/obex-root-setup
+%{_bindir}/obex.sh
 
 %files test
 %manifest %{name}.manifest
diff --git a/packaging/obex.sh b/packaging/obex.sh
new file mode 100755 (executable)
index 0000000..884abde
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# This script has to be launched by systemd obex service.
+# It was separated from the systemd service to check
+# the presence of obex root directory. If the directory
+# does not exist, then create it.
+if [ ! -z `ps ax | grep -v grep | grep obexd` ];
+then return
+fi
+
+eval $(tzplatform-get TZ_USER_CONTENT);
+
+if [ ! -d $TZ_USER_CONTENT ];
+then mkdir -p $TZ_USER_CONTENT;
+fi
+
+exec /lib/bluetooth/obexd -d --noplugin=syncevolution,pcsuite,irmc --symlinks -r $TZ_USER_CONTENT;
+