From 2a4cf320f63e21270bdaaaedf6152542a37e4be8 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Mon, 12 Mar 2018 19:47:42 +0900 Subject: [PATCH] Add the service file for controlling bluetooth rfkill Change-Id: I9164b9efbe1f1a2e95f452e9a63908254ea32e02 Signed-off-by: Hyuk Lee --- packaging/bluetooth-rfkill-block.path | 5 +++++ packaging/bluetooth-rfkill-block.service | 13 +++++++++++++ packaging/bluetooth-rfkill-unblock.path | 5 +++++ packaging/bluetooth-rfkill-unblock.service | 13 +++++++++++++ packaging/bluetooth-tools.spec | 16 ++++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 packaging/bluetooth-rfkill-block.path create mode 100644 packaging/bluetooth-rfkill-block.service create mode 100644 packaging/bluetooth-rfkill-unblock.path create mode 100644 packaging/bluetooth-rfkill-unblock.service diff --git a/packaging/bluetooth-rfkill-block.path b/packaging/bluetooth-rfkill-block.path new file mode 100644 index 0000000..5cc7e93 --- /dev/null +++ b/packaging/bluetooth-rfkill-block.path @@ -0,0 +1,5 @@ +[Unit] +Description=Path activation for blocking bluetooth rfkill + +[Path] +PathExists=/run/.rfkill_block diff --git a/packaging/bluetooth-rfkill-block.service b/packaging/bluetooth-rfkill-block.service new file mode 100644 index 0000000..02ef0ca --- /dev/null +++ b/packaging/bluetooth-rfkill-block.service @@ -0,0 +1,13 @@ +[Unit] +Description=Service to block the bluetooth rfkill normally + +[Service] +Type=oneshot +SmackProcessLabel=System +ExecStartPre=/usr/bin/rm -f /run/.rfkill_block +ExecStart=/usr/sbin/rfkill block bluetooth +RemainAfterExit=no +StandardOutput=journal+console +SuccessExitStatus=1 +StartLimitInterval=1 +StartLimitBurst=10 diff --git a/packaging/bluetooth-rfkill-unblock.path b/packaging/bluetooth-rfkill-unblock.path new file mode 100644 index 0000000..a2ea6c2 --- /dev/null +++ b/packaging/bluetooth-rfkill-unblock.path @@ -0,0 +1,5 @@ +[Unit] +Description=Path activation for unblocking bluetooth rfkill + +[Path] +PathExists=/run/.rfkill_unblock diff --git a/packaging/bluetooth-rfkill-unblock.service b/packaging/bluetooth-rfkill-unblock.service new file mode 100644 index 0000000..b9e9fdb --- /dev/null +++ b/packaging/bluetooth-rfkill-unblock.service @@ -0,0 +1,13 @@ +[Unit] +Description=Service to unblock the bluetooth rfkill normally + +[Service] +Type=oneshot +SmackProcessLabel=System +ExecStartPre=/usr/bin/rm -f /run/.rfkill_unblock +ExecStart=/usr/sbin/rfkill unblock bluetooth +RemainAfterExit=no +StandardOutput=journal+console +SuccessExitStatus=1 +StartLimitInterval=1 +StartLimitBurst=10 diff --git a/packaging/bluetooth-tools.spec b/packaging/bluetooth-tools.spec index d256a59..1f051b4 100644 --- a/packaging/bluetooth-tools.spec +++ b/packaging/bluetooth-tools.spec @@ -97,6 +97,12 @@ install -D -m 0644 packaging/bluetooth-hci-logger.path %{buildroot}%{_libdir}/sy install -D -m 0644 packaging/bluetooth-hci-logger-stop.service %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-logger-stop.service install -D -m 0644 packaging/bluetooth-hci-logger-stop.path %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-logger-stop.path +install -D -m 0644 packaging/bluetooth-rfkill-unblock.service %{buildroot}%{_libdir}/systemd/system/bluetooth-rfkill-unblock.service +install -D -m 0644 packaging/bluetooth-rfkill-unblock.path %{buildroot}%{_libdir}/systemd/system/bluetooth-rfkill-unblock.path + +install -D -m 0644 packaging/bluetooth-rfkill-block.service %{buildroot}%{_libdir}/systemd/system/bluetooth-rfkill-block.service +install -D -m 0644 packaging/bluetooth-rfkill-block.path %{buildroot}%{_libdir}/systemd/system/bluetooth-rfkill-block.path + 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 @@ -111,6 +117,12 @@ mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-hci-logger.path +ln -sf %{_libdir}/systemd/system/bluetooth-rfkill-unblock.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ +ln -sf %{_libdir}/systemd/system/bluetooth-rfkill-unblock.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-rfkill-unblock.path + +ln -sf %{_libdir}/systemd/system/bluetooth-rfkill-block.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ +ln -sf %{_libdir}/systemd/system/bluetooth-rfkill-block.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-rfkill-block.path + ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger-stop.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger-stop.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-hci-logger-stop.path @@ -140,6 +152,10 @@ ln -sf %{_libdir}/systemd/system/bluetooth-force-hci-logger.service %{_sysconfdi #%{_unitdir}/bluetooth-address.service %{_libdir}/systemd/system/bluetooth-hci-logger.service %{_libdir}/systemd/system/bluetooth-hci-logger.path +%{_libdir}/systemd/system/bluetooth-rfkill-unblock.service +%{_libdir}/systemd/system/bluetooth-rfkill-unblock.path +%{_libdir}/systemd/system/bluetooth-rfkill-block.service +%{_libdir}/systemd/system/bluetooth-rfkill-block.path %{_libdir}/systemd/system/bluetooth-hci-logger-stop.service %{_libdir}/systemd/system/bluetooth-hci-logger-stop.path %{_libdir}/systemd/system/bluez-start.service -- 2.7.4