Add bt-stack-up.service and modify bt-stack-down.service 92/192392/3 submit/tizen/20181106.081159
authorWootak Jung <wootak.jung@samsung.com>
Mon, 5 Nov 2018 08:12:52 +0000 (17:12 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 5 Nov 2018 08:43:24 +0000 (17:43 +0900)
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
packaging/bluetooth-stack-up.path [new file with mode: 0644]
packaging/bluetooth-stack-up.service [new file with mode: 0644]
packaging/bluetooth-tools.spec

index 9f9d29d..1a46d52 100644 (file)
@@ -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 (file)
index 0000000..6377917
--- /dev/null
@@ -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 (file)
index 0000000..fe13beb
--- /dev/null
@@ -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
index 015ecd9..37deca8 100644 (file)
@@ -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