From 07bdeb618181eac33dc2bc39227315e3f604e40a Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 12 Aug 2013 17:00:34 +0200 Subject: [PATCH] bluez: move obex init scripts to systemd Signed-off-by: Stephan Raue --- packages/network/bluez/init.d/55_obexd | 47 ------------------- packages/network/bluez/package.mk | 2 + .../network/bluez/system.d/bluetooth.service | 4 +- .../network/bluez/system.d/obex-monitor.path | 9 ++++ .../bluez/system.d/obex-monitor.service | 10 ++++ packages/network/bluez/system.d/obex.service | 16 +++++++ .../systemd/scripts/openelec-debugconfig | 2 + 7 files changed, 41 insertions(+), 49 deletions(-) delete mode 100644 packages/network/bluez/init.d/55_obexd create mode 100644 packages/network/bluez/system.d/obex-monitor.path create mode 100644 packages/network/bluez/system.d/obex-monitor.service create mode 100644 packages/network/bluez/system.d/obex.service diff --git a/packages/network/bluez/init.d/55_obexd b/packages/network/bluez/init.d/55_obexd deleted file mode 100644 index 1f0f5b67f0..0000000000 --- a/packages/network/bluez/init.d/55_obexd +++ /dev/null @@ -1,47 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -# -# start obexd -# -# runlevels: openelec, textmode - -( - # can be called from openelec addon. - # ensure that environment is sane - . /etc/profile - - if [ "$DEBUG" = "yes" ]; then - OBEXD_DEBUG="-d" - fi - - OBEXD_ENABLED=true - OBEXD_ROOT=/storage/downloads - if [ -f $CONFIG_CACHE/service_bluez.conf ]; then - . $CONFIG_CACHE/service_bluez.conf - fi - - if [ "$BLUEZ_ENABLED" == "true" -a "$OBEXD_ENABLED" == "true" ]; then - progress "Starting obexd" - wait_for_dbus - mkdir -p "$OBEXD_ROOT" - /usr/lib/bluetooth/obexd $OBEXD_DEBUG -r "$OBEXD_ROOT" &>/dev/null - fi -)& diff --git a/packages/network/bluez/package.mk b/packages/network/bluez/package.mk index 04fdf3560f..b7f901b4d1 100644 --- a/packages/network/bluez/package.mk +++ b/packages/network/bluez/package.mk @@ -77,5 +77,7 @@ post_makeinstall_target() { post_install() { enable_service bluetooth-monitor.path enable_service bluetooth.service + enable_service obex-monitor.path + enable_service obex.service } diff --git a/packages/network/bluez/system.d/bluetooth.service b/packages/network/bluez/system.d/bluetooth.service index 44657ee3a2..762a46ba4c 100644 --- a/packages/network/bluez/system.d/bluetooth.service +++ b/packages/network/bluez/system.d/bluetooth.service @@ -6,9 +6,9 @@ ConditionPathExists=/storage/.cache/services/bluez.conf [Service] NotifyAccess=main -# EnvironmentFile=/storage/.cache/services/avahi.conf +EnvironmentFile=/storage/.cache/services/bluez.conf EnvironmentFile=-/run/openelec/debug.conf -ExecStart=/usr/lib/bluetooth/bluetoothd $BLUETOOTH_DEBUG +ExecStart=/usr/lib/bluetooth/bluetoothd $BLUEZ_ARGS $BLUEZ_DEBUG CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW LimitNPROC=1 diff --git a/packages/network/bluez/system.d/obex-monitor.path b/packages/network/bluez/system.d/obex-monitor.path new file mode 100644 index 0000000000..ad25368960 --- /dev/null +++ b/packages/network/bluez/system.d/obex-monitor.path @@ -0,0 +1,9 @@ +[Unit] +Description=OBEX configfile monitor + +[Path] +PathModified=/storage/.cache/services/obex.conf +PathModified=/run/openelec/debug.conf + +[Install] +WantedBy=bluetooth.target diff --git a/packages/network/bluez/system.d/obex-monitor.service b/packages/network/bluez/system.d/obex-monitor.service new file mode 100644 index 0000000000..0fd27f43a2 --- /dev/null +++ b/packages/network/bluez/system.d/obex-monitor.service @@ -0,0 +1,10 @@ +[Unit] +Description=Bluetooth configfile monitor +Requires=bluetooth.target bluetooth.service + +[Service] +Type=oneshot +ExecStart=/bin/systemctl restart obex.service + +[Install] +WantedBy=bluetooth.target diff --git a/packages/network/bluez/system.d/obex.service b/packages/network/bluez/system.d/obex.service new file mode 100644 index 0000000000..db2198bd1a --- /dev/null +++ b/packages/network/bluez/system.d/obex.service @@ -0,0 +1,16 @@ +[Unit] +Description=Bluetooth service +Requires=bluetooth.target bluetooth.service +After=bluetooth.service + +ConditionPathExists=/storage/.cache/services/obex.conf +ConditionPathExists=/storage/.cache/services/bluez.conf + +[Service] +EnvironmentFile=/storage/.cache/services/obex.conf +EnvironmentFile=-/run/openelec/debug.conf +ExecStart=/usr/lib/bluetooth/obexd $OBEX_ARGS $OBEX_DEBUG + +[Install] +WantedBy=bluetooth.target +Alias=dbus-org.bluez.obex.service diff --git a/packages/sysutils/systemd/scripts/openelec-debugconfig b/packages/sysutils/systemd/scripts/openelec-debugconfig index 90a39c9cc1..a46737aa47 100755 --- a/packages/sysutils/systemd/scripts/openelec-debugconfig +++ b/packages/sysutils/systemd/scripts/openelec-debugconfig @@ -23,5 +23,7 @@ mkdir -p /run/openelec cat > /run/openelec/debug.conf <