[Replicant] [replicant-scripts][PATCH 8/8] modem: setup.sh: only continue if adb root succedded

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri Jun 19 04:08:49 UTC 2020


This way if we don't have root access enable it will only
show the following error message:
    root access is disabled by system setting - enable in
    settings -> development options

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 networking/modem/setup.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/networking/modem/setup.sh b/networking/modem/setup.sh
index 8f943f5..ba7a75c 100755
--- a/networking/modem/setup.sh
+++ b/networking/modem/setup.sh
@@ -1,8 +1,11 @@
 #!/bin/sh
 topdir=$(dirname $0)
-adb root
-adb wait-for-device
-adb remount
-adb push "${topdir}/device-files/modem.sh" /system/bin/
-adb shell "mount -o remount,ro /system"
-adb shell "sync"
+adb root | grep "^root access"
+ret="$?"
+if [ "${ret}" -ne 0 ] ; then
+	adb wait-for-device
+	adb remount
+	adb push "${topdir}/device-files/modem.sh" /system/bin/
+	adb shell "mount -o remount,ro /system"
+	adb shell "sync"
+fi
-- 
2.27.0



More information about the Replicant mailing list