From 1c8d2946202e474b600d162094d3e47d6e323790 Mon Sep 17 00:00:00 2001 From: tony Date: Tue, 19 Aug 2014 17:01:52 +0800 Subject: [PATCH] fix obex systemd service to support multiuser 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 --- obexd/src/obex.service.in | 3 +-- packaging/bluez.spec | 3 +++ packaging/obex.sh | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 packaging/obex.sh diff --git a/obexd/src/obex.service.in b/obexd/src/obex.service.in index b381be2..217d7ab 100644 --- a/obexd/src/obex.service.in +++ b/obexd/src/obex.service.in @@ -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 diff --git a/packaging/bluez.spec b/packaging/bluez.spec index 43e64b6..e251d9d 100644 --- a/packaging/bluez.spec +++ b/packaging/bluez.spec @@ -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 index 0000000..884abde --- /dev/null +++ b/packaging/obex.sh @@ -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; + -- 2.7.4