Open bkensey opened 11 years ago
Any Android build should have the basics such as ls, cp, rm, which is all the app really needs. Sometimes the arguments differ. Detecting busybox is relatively easy. The latest RootTools repo from stericson has some simple methods for doing just that.
The app uses several commands above and beyond the basics. Some of those are exclusive to the priviliged console, and some are used by both. I want to allow the user to download the full list of required commands to the appropriate system files, which would help out a lot of rooted oem phone users.
A full list of used commands can be found here: https://github.com/bkensey/Backbone/blob/gradle-test/res/xml/command_list.xml
I should add that the problem isn't recognizing the existence of those commands. That is something the app already does, and if they are not present it will fall back to the java console from the various flavors of the shell console. We need the download utility to ensure that non-ROM users can use the shell console.
Ok, so I'm thinking we can offer a simple download/install of busybox when we find that it's not installed. Upon confirmation, we: 1) Check /proc/cpuinfo, grab the processor type 2) Download the corresponding binary of busybox over at http://busybox.net/downloads/binaries/latest/ 3) Request root (despite Safe mode being "on", we need this for the next step) 4) Remount system partition as RW 5) Copy downloaded binary to /system/xbin 6) Remount system as RO 7) Notify user 8) Call back to BB to say Busybox is installed
The only concern I have is symlinking all of the functions to busybox. I'm not sure if we should try doing that, as that may be out of the scope of our app. Also, I think we explicitly call busybox when needed (i.e. "busybox stat -f
Actually, it looks like "uname -m" gives a much better result than /proc/cpuinfo.
Would there be any way to just download the needed commands instead of relying on the busybox package? These being the required commands: /system/bin/cat, /system/bin/chmod, /system/bin/chown, /system/bin/dd, /system/bin/df, /system/bin/gzip, /system/bin/id, /system/bin/kill, /system/bin/ln, /system/bin/ls, /system/bin/mkdir, /system/bin/mount, /system/bin/mv, /system/bin/ps, /system/bin/rm, /system/bin/sh, /system/xbin/awk, /system/xbin/bunzip2, /system/xbin/busybox, /system/xbin/bzip2, /system/xbin/cp, /system/xbin/cut, /system/xbin/dirname, /system/xbin/echo, /system/xbin/find, /system/xbin/grep, /system/xbin/groups, /system/xbin/gunzip, /system/xbin/pwd, /system/xbin/readlink, /system/xbin/stat, /system/xbin/su, /system/xbin/tar, /system/xbin/xargs, /system/xbin/md5sum, /system/xbin/sha1sum
Sure, but that would ultimately be a messier way to do it. Also, I'm pretty sure Backbone looks for BusyBox specifically.
I see what you mean when you say it might be outside the scope of our app. I guess the question comes down to whether we're stepping on any other app's toes if we do all of that for the user, and whether any other apps even make use of that full set of commands like we do.
For when the user's phone is rooted but does not come pre-built with the standard xbin commands like those found in CM. The utility should only prompt the user to download busybox if the user enters root mode. I have no idea what the app currently does on non CM devices. Either crash or default to its internal Java operations console.