Run bt-stack-down.sh script as network_fw permission 72/182072/2
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 20 Jun 2018 07:09:13 +0000 (16:09 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 20 Jun 2018 08:03:59 +0000 (17:03 +0900)
Change-Id: Ia43ccf76ea5de488d3404fa69f7e7010b2448ca3
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
packaging/bluetooth-stack-down-with-radio.service
packaging/bluetooth-stack-down.service
scripts/etc/bt-stack-down.sh
scripts/ivi/bt-stack-down.sh
scripts/mobile/bt-stack-down-with-radio.sh
scripts/mobile/bt-stack-down.sh
scripts/wearable/bt-stack-down.sh

index e163009..cb8e972 100644 (file)
@@ -2,5 +2,10 @@
 Description=Service to run bt-stack-down-with-radio.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-with-radio.sh
index 784a278..9f9d29d 100644 (file)
@@ -2,5 +2,10 @@
 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
index a7b6071..e476281 100644 (file)
@@ -11,46 +11,13 @@ PGREP=/usr/bin/pgrep
 
 # Kill BlueZ bluetooth stack
 
-BLUETOOTH_PID=$($PGREP bluetooth)
-if [ "$BLUETOOTH_PID" != "" ]; then
-       kill $BLUETOOTH_PID
-fi
-
-OBEXD_PID=$($PGREP obexd)
-if [ "$OBEXD_PID" != "" ]; then
-       kill $OBEXD_PID
-fi
-
-OBEXDCLIENT_PID=$($PGREP obexd-client)
-if [ "$OBEXDCLIENT_PID" != "" ]; then
-       kill $OBEXDCLIENT_PID
-fi
-
-BTSHARE_PID=$($PGREP bluetooth-share)
-if [ "$BTSHARE_PID" != "" ]; then
-       kill $BTSHARE_PID
-fi
-
-BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
-if [ "$BTPB_AGENT_PID" != "" ]; then
-       kill $BTPB_AGENT_PID
-fi
-
-BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
-if [ "$BTMAP_AGENT_PID" != "" ]; then
-       kill $BTMAP_AGENT_PID
-fi
-
-BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent)
-if [ "$BTHFP_AGENT_PID" != "" ]; then
-       kill $BTHFP_AGENT_PID
-fi
-
-BLUETOOTHD_PID=$($PGREP bluetoothd)
-if [ "$BLUETOOTHD_PID" != "" ]; then
-       kill $BLUETOOTHD_PID
-fi
-
+pkill --full obexd
+pkill --full obexd-client
+pkill --full bt-syspopup
+pkill --full bluetooth-pb-agent
+pkill --full bluetooth-map-agent
+pkill --full bluetooth-hfp-agent
+pkill --full bluetoothd
 
 # result
 exit 0
index e7445e8..4aeeb40 100644 (file)
@@ -11,35 +11,13 @@ PGREP=/usr/bin/pgrep
 
 # Kill BlueZ bluetooth stack
 
-OBEXD_PID=$($PGREP obexd)
-if [ "$OBEXD_PID" != "" ]; then
-       kill $OBEXD_PID
-fi
-
-OBEXDCLIENT_PID=$($PGREP obexd-client)
-if [ "$OBEXDCLIENT_PID" != "" ]; then
-       kill $OBEXDCLIENT_PID
-fi
-
-BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
-if [ "$BTPB_AGENT_PID" != "" ]; then
-       kill $BTPB_AGENT_PID
-fi
-
-BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
-if [ "$BTMAP_AGENT_PID" != "" ]; then
-       kill $BTMAP_AGENT_PID
-fi
-
-BTHF_AGENT_PID=$($PGREP bluetooth-hf-agent)
-if [ "$BTHF_AGENT_PID" != "" ]; then
-       kill $BTHF_AGENT_PID
-fi
-
-BLUETOOTHD_PID=$($PGREP bluetoothd)
-if [ "$BLUETOOTHD_PID" != "" ]; then
-       kill $BLUETOOTHD_PID
-fi
+pkill --full obexd
+pkill --full obexd-client
+pkill --full bt-syspopup
+pkill --full bluetooth-pb-agent
+pkill --full bluetooth-map-agent
+pkill --full bluetooth-hf-agent
+pkill --full bluetoothd
 
 # result
 exit 0
index 664b063..17d213e 100755 (executable)
@@ -12,14 +12,15 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 systemctl stop bluetooth-hci-logger.service
 
 # Kill BlueZ bluetooth stack
-killall obexd obex-client
-killall bt-syspopup
-killall bluetooth-pb-agent
-killall bluetooth-map-agent
-killall bluetooth-hfp-agent
-killall bluetooth-ag-agent
-killall bluetoothd
-killall bluetooth-share
+pkill --full obexd
+pkill --full obexd-client
+pkill --full bt-syspopup
+pkill --full bluetooth-share
+pkill --full bluetooth-pb-agent
+pkill --full bluetooth-map-agent
+pkill --full bluetooth-hfp-agent
+pkill --full bluetooth-ag-agent
+pkill --full bluetoothd
 
 # result
 exit 0
index 4a673d4..0ff09a6 100644 (file)
@@ -14,50 +14,15 @@ PGREP=/usr/bin/pgrep
 
 # Kill BlueZ bluetooth stack
 
-OBEXD_PID=$($PGREP obexd)
-if [ "$OBEXD_PID" != "" ]; then
-       kill $OBEXD_PID
-fi
-
-OBEXDCLIENT_PID=$($PGREP obexd-client)
-if [ "$OBEXDCLIENT_PID" != "" ]; then
-       kill $OBEXDCLIENT_PID
-fi
-
-BTSYSPOPUP_PID=$($PGREP bt-syspopup)
-if [ "BTSYSPOPUP_PID" != "" ]; then
-       kill BTSYSPOPUP_PID
-fi
-
-BTSHARE_PID=$($PGREP bluetooth-share)
-if [ "$BTSHARE_PID" != "" ]; then
-       kill $BTSHARE_PID
-fi
-
-BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
-if [ "$BTPB_AGENT_PID" != "" ]; then
-       kill $BTPB_AGENT_PID
-fi
-
-BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
-if [ "$BTMAP_AGENT_PID" != "" ]; then
-       kill $BTMAP_AGENT_PID
-fi
-
-BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent)
-if [ "$BTHFP_AGENT_PID" != "" ]; then
-       kill $BTHFP_AGENT_PID
-fi
-
-BTAG_AGENT_PID=$($PGREP bluetooth-ag-agent)
-if [ "$BTAG_AGENT_PID" != "" ]; then
-       kill $BTAG_AGENT_PID
-fi
-
-BLUETOOTHD_PID=$($PGREP bluetoothd)
-if [ "$BLUETOOTHD_PID" != "" ]; then
-       kill $BLUETOOTHD_PID
-fi
+pkill --full obexd
+pkill --full obexd-client
+pkill --full bt-syspopup
+pkill --full bluetooth-share
+pkill --full bluetooth-pb-agent
+pkill --full bluetooth-map-agent
+pkill --full bluetooth-hfp-agent
+pkill --full bluetooth-ag-agent
+pkill --full bluetoothd
 
 # result
 exit 0
index 22f3043..6156454 100755 (executable)
@@ -14,46 +14,15 @@ PGREP=/usr/bin/pgrep
 
 # Kill BlueZ bluetooth stack
 
-OBEXD_PID=$($PGREP obexd)
-if [ "$OBEXD_PID" != "" ]; then
-       kill $OBEXD_PID
-fi
-
-OBEXDCLIENT_PID=$($PGREP obexd-client)
-if [ "$OBEXDCLIENT_PID" != "" ]; then
-       kill $OBEXDCLIENT_PID
-fi
-
-BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
-if [ "$BTPB_AGENT_PID" != "" ]; then
-       kill $BTPB_AGENT_PID
-fi
-
-BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
-if [ "$BTMAP_AGENT_PID" != "" ]; then
-       kill $BTMAP_AGENT_PID
-fi
-
-BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent)
-if [ "$BTHFP_AGENT_PID" != "" ]; then
-       kill $BTHFP_AGENT_PID
-fi
-
-BTHF_AGENT_PID=$($PGREP bluetooth-hf-agent)
-if [ "$BTHF_AGENT_PID" != "" ]; then
-       kill $BTHF_AGENT_PID
-fi
-
-BTAG_AGENT_PID=$($PGREP bluetooth-ag-agent)
-if [ "$BTAG_AGENT_PID" != "" ]; then
-       kill $BTAG_AGENT_PID
-fi
-
-BLUETOOTHD_PID=$($PGREP bluetoothd)
-if [ "$BLUETOOTHD_PID" != "" ]; then
-       kill $BLUETOOTHD_PID
-fi
-
+pkill --full obexd
+pkill --full obexd-client
+pkill --full bt-syspopup
+pkill --full bluetooth-pb-agent
+pkill --full bluetooth-map-agent
+pkill --full bluetooth-hfp-agent
+pkill --full bluetooth-hf-agent
+pkill --full bluetooth-ag-agent
+pkill --full bluetoothd
 
 # result
 exit 0