xref: /btstack/port/mtk/deinstaller.sh (revision 8caefee39d444df6d8908a96a844825f10fbdaa4)
1*8caefee3SMatthias Ringwald#!/bin/bash
2*8caefee3SMatthias Ringwald
3*8caefee3SMatthias Ringwaldecho "BTstack Deinstaller for RugGear/Mediatek devices"
4*8caefee3SMatthias Ringwald
5*8caefee3SMatthias Ringwald# make /system writable
6*8caefee3SMatthias Ringwaldif adb shell mount | grep -q "/system ext4 ro" ; then
7*8caefee3SMatthias Ringwald	echo "- remounting /system as read/write"
8*8caefee3SMatthias Ringwald	adb shell su root mount -o remount,rw /emmc@android /system
9*8caefee3SMatthias Ringwaldfi
10*8caefee3SMatthias Ringwald
11*8caefee3SMatthias Ringwaldif adb shell mount | grep -q "/system ext4 ro" ; then
12*8caefee3SMatthias Ringwald	echo "- remounting failed, abort"
13*8caefee3SMatthias Ringwaldfi
14*8caefee3SMatthias Ringwaldecho "- /system mounted as read/write"
15*8caefee3SMatthias Ringwald
16*8caefee3SMatthias Ringwaldif adb shell stat /system/bin/BTstackDaemon | grep -q "regular file" ; then
17*8caefee3SMatthias Ringwaldecho "- deleting BTstackDaemon and BTstackDaemonRespawn"
18*8caefee3SMatthias Ringwaldadb shell su root rm /system/bin/BTstackDaemon
19*8caefee3SMatthias Ringwaldadb shell su root rm /system/bin/BTstackDaemonRespawn
20*8caefee3SMatthias Ringwaldfi
21*8caefee3SMatthias Ringwald
22*8caefee3SMatthias Ringwaldecho "- stopping Bluetooth daemon"
23*8caefee3SMatthias Ringwaldadb shell su root setprop ctl.stop mtkbt
24*8caefee3SMatthias Ringwald
25*8caefee3SMatthias Ringwald# put mtkbt back in place
26*8caefee3SMatthias Ringwaldecho "- restore mtkbk"
27*8caefee3SMatthias Ringwaldadb shell su root cp /system/bin/mtkbt_orig /system/bin/mtkbt
28*8caefee3SMatthias Ringwald
29*8caefee3SMatthias Ringwaldecho "- start Bluetooth daemon"
30*8caefee3SMatthias Ringwaldadb shell su root setprop ctl.start mtkbt
31*8caefee3SMatthias Ringwald
32*8caefee3SMatthias Ringwaldecho "DONE"
33