From 7f531ecc3dad05fdc949611127b166e501180bde Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Mon, 5 Nov 2018 17:12:52 +0900 Subject: [PATCH] Add bt-stack-up.service and modify bt-stack-down.service bt-stack-up.service should be alived during bt enabled. And, bt-stack-down.service will stop this service. Change-Id: Ib7b169ac9819bf22b8f3687872343c5a9563f188 --- packaging/bluetooth-stack-down.service | 3 +-- packaging/bluetooth-stack-up.path | 5 +++++ packaging/bluetooth-stack-up.service | 11 +++++++++++ packaging/bluetooth-tools.spec | 9 +++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 packaging/bluetooth-stack-up.path create mode 100644 packaging/bluetooth-stack-up.service diff --git a/packaging/bluetooth-stack-down.service b/packaging/bluetooth-stack-down.service index 9f9d29d..1a46d52 100644 --- a/packaging/bluetooth-stack-down.service +++ b/packaging/bluetooth-stack-down.service @@ -2,10 +2,9 @@ Description=Service to run bt-stack-down.sh script to terminate BT functions [Service] -User=network_fw -Group=network_fw Type=oneshot SmackProcessLabel=System SecureBits=keep-caps Capabilities=cap_kill=i ExecStart=/usr/etc/bluetooth/bt-stack-down.sh +ExecStartPost=/usr/bin/systemctl stop bluetooth-stack-up diff --git a/packaging/bluetooth-stack-up.path b/packaging/bluetooth-stack-up.path new file mode 100644 index 0000000..6377917 --- /dev/null +++ b/packaging/bluetooth-stack-up.path @@ -0,0 +1,5 @@ +[Unit] +Description=Path activation for the "bluetooth-stack-up.service" + +[Path] +PathExists=/run/.bt_stack_up diff --git a/packaging/bluetooth-stack-up.service b/packaging/bluetooth-stack-up.service new file mode 100644 index 0000000..fe13beb --- /dev/null +++ b/packaging/bluetooth-stack-up.service @@ -0,0 +1,11 @@ +[Unit] +Description=Service to run bt-stack-up.sh script to start BT functions + +[Service] +Type=oneshot +SupplementaryGroups=priv_mediastorage priv_externalstorage dialout +ExecStart=/usr/etc/bluetooth/bt-stack-up.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/packaging/bluetooth-tools.spec b/packaging/bluetooth-tools.spec index 015ecd9..37deca8 100644 --- a/packaging/bluetooth-tools.spec +++ b/packaging/bluetooth-tools.spec @@ -100,6 +100,9 @@ install -D -m 0644 packaging/bluetooth-hci-logger-stop.path %{buildroot}%{_libdi install -D -m 0644 packaging/bluez-start.service %{buildroot}%{_libdir}/systemd/system/bluez-start.service install -D -m 0644 packaging/bluez-start.path %{buildroot}%{_libdir}/systemd/system/bluez-start.path +install -D -m 0644 packaging/bluetooth-stack-up.service %{buildroot}%{_libdir}/systemd/system/bluetooth-stack-up.service +install -D -m 0644 packaging/bluetooth-stack-up.path %{buildroot}%{_libdir}/systemd/system/bluetooth-stack-up.path + install -D -m 0644 packaging/bluetooth-stack-down.service %{buildroot}%{_libdir}/systemd/system/bluetooth-stack-down.service install -D -m 0644 packaging/bluetooth-stack-down.path %{buildroot}%{_libdir}/systemd/system/bluetooth-stack-down.path @@ -129,6 +132,10 @@ ln -sf %{_libdir}/systemd/system/bluez-start.service %{_sysconfdir}/systemd/defa ln -sf %{_libdir}/systemd/system/bluez-start.path %{_libdir}/systemd/system/multi-user.target.wants/bluez-start.path ln -sf %{_libdir}/systemd/system/bluez-start.path %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ +ln -sf %{_libdir}/systemd/system/bluetooth-stack-up.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ +ln -sf %{_libdir}/systemd/system/bluetooth-stack-up.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-stack-up.path +ln -sf %{_libdir}/systemd/system/bluetooth-stack-up.path %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ + ln -sf %{_libdir}/systemd/system/bluetooth-stack-down.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ ln -sf %{_libdir}/systemd/system/bluetooth-stack-down.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-stack-down.path ln -sf %{_libdir}/systemd/system/bluetooth-stack-down.path %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ @@ -165,6 +172,8 @@ ln -sf %{_libdir}/systemd/system/bluetooth-hci-down.path %{_sysconfdir}/systemd/ %{_libdir}/systemd/system/bluez-start.path %{_libdir}/systemd/system/bluetooth-force-hci-logger.service %{_libdir}/systemd/system/bluetooth-hci-dump@.service +%{_libdir}/systemd/system/bluetooth-stack-up.service +%{_libdir}/systemd/system/bluetooth-stack-up.path %{_libdir}/systemd/system/bluetooth-stack-down.service %{_libdir}/systemd/system/bluetooth-stack-down.path %{_libdir}/systemd/system/bluetooth-hci-up.service -- 2.7.4