I'm hoping to be able to get some feedback and bounce this idea around. I wasn't able to figure out the right terms for a google search with good results even though I spent a while trying.
From an Android application, I want to determine where the busybox binary is installed on the system or data partition. I was hoping for a pure java solution, but I don't think there are any android java APIs for calling the shell PATH variable...
I also wanted to avoid hard coding the common linux binary directories (ex. /system/bin and /system/xbin, etc.)
From a shell perspective, I would usually run busybox find / -name busybox to locate it. Or I'd run busybox which busybox .. none of these are pure Android java solutions.
There are only two ways I'm aware of:
1) Using the linux binary "which". I could compile this for arm (or use the busybox applet) and package this binary into the application, have it extract when the application loads and execute and parse the output. Could do the same with the find linux binary...
2) Use the RootTools method Stericson published - InternalMethods.java. Although his approach uses a root shell to run dd to copy it from /init.rc (permissions usually read only for root) into /data/local/tmp and set it 777 so the android application and parse it for the export PATH line.
EDIT: found another method .. kind of an interesting approach.
http://osdir.com/ml/AndroidDevelopers/2009-03/msg04053.html
ps | grep /system/bin/sh
cat /proc/<pid>/environ
have to parse some of that output, but it seems to work thru adb shell w/o root.
I very well might have overlooked something or missed another approach. Any other ideas or other approaches?
Thanks in advance!
Include busybox with your app, no need to worry about its version
Couldn't you use java.lang.System.getenv()?
http://developer.android.com/reference/java/lang/System.html#getenv(java.lang.String)
doixanh said:
Include busybox with your app, no need to worry about its version
Click to expand...
Click to collapse
lol. unfortunately the scope of my app is only to show the user where their busybox binary is currently located, not provide them with a busybox binary.
Gene Poole said:
Couldn't you use java.lang.System.getenv()?
http://developer.android.com/reference/java/lang/System.html#getenv(java.lang.String)
Click to expand...
Click to collapse
Wow! very interesting. Sad I couldn't find this in all my searching through the android docs.
Two questions after looking over the information I can probably answer through testing, but can't test at the moment. If anybody knows the answer, would be helpful. Otherwise I'll post back when I am able to test.
1) Would the SecurityManager block a 3rd party app from using this call as it might be reserved for only apps signed with platform keys? I can compile and test watching logcat to see if it blocks this call.
2) For the getenv(String name) method, what value should be passed as the string? I can probably bypass this by just running the getenv w/o a string to have it return the Map and sort through the map.
Thanks for the help/suggestions/feedback!
Finally had a chance to test!
Gene Poole said:
Couldn't you use java.lang.System.getenv()?
http://developer.android.com/reference/java/lang/System.html#getenv(java.lang.String)
Click to expand...
Click to collapse
Turns out to be the perfect answer!!
This is the exact command I was looking for:
textBox.setText(System.getenv("PATH"));
Found a great test example for implementing real quick - How do I get Environment Variables?
Here is the output on my EVO 3D:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Related
Hi XDA Dev's,
I have a program called words. It's a windows based, but ported to linux program which is able to function as an English to Latin and reversed dictionary.
The program has to be ran in the Terminal, cos it is command line interface based.
I thought since it is a program ran in the Terminal you should be able to run it in the Android Terminal, but that's just a theory.
Practically it doesn't work that way.
After untarring the app I entered ./words or su ./words but either won't work.
It gives me the following:
(I took the block from the internet so hope you see a block, not some kind of symbol: )
EL4: not found
4: not found
4: not found
: not found
./words: 5 Syntax error: "(" unexpected
So I think the Android Terminal reads differently cos it doesn't expect that character.
The question is: How can I port a linux CLI program to Android? And is this possible with the App Inventor from Google?
I don't really understand ypur question. If you would like to run a shell script try this
Code:
sh script.sh
Sent from my GT-I5700 using XDA App
Hmm sh gives me almost the same error.
But that's the thing, I have no clue what it is, there are a few files which are being used by the program. One of them is words, but it has no extension.
TT5555 said:
Hi XDA Dev's,
I have a program called words. It's a windows based, but ported to linux program which is able to function as an English to Latin and reversed dictionary.
The program has to be ran in the Terminal, cos it is command line interface based.
I thought since it is a program ran in the Terminal you should be able to run it in the Android Terminal, but that's just a theory.
Practically it doesn't work that way.
After untarring the app I entered ./words or su ./words but either won't work.
It gives me the following:
(I took the block from the internet so hope you see a block, not some kind of symbol: )
EL4: not found
4: not found
4: not found
: not found
./words: 5 Syntax error: "(" unexpected
So I think the Android Terminal reads differently cos it doesn't expect that character.
The question is: How can I port a linux CLI program to Android? And is this possible with the App Inventor from Google?
Click to expand...
Click to collapse
Hi, If you can get the source code to the program, then potentially the program can be ported to Android/ARM CPU architecture. The fact that it is a command-line program isnt such an issue - an Android app can be designed to interact with that (eg using Runtime.getRuntime().exec()).
If you just copied over the binary that runs ok under Linux on your PC, and tried to execute it on your Android device, it wont work. Your PC is running x86/x64 based CPU, your Android device is running ARM based CPU (eg you're putting diesel fuel into a car that needs petrol).
- jc
If I had the dictionary file, I could put it on my hosted site and write an app.
Rootstonian said:
If I had the dictionary file, I could put it on my hosted site and write an app.
Click to expand...
Click to collapse
You said it like it's that easy; but if you want I'd appreciate it.
The link on the official site doesn't work anymore so I uploaded the .tar.gz file on my website. Direct link:
http://www.freewebs.com/hoitom/words-1.97Ed-linux.tar.gz
Click to expand...
Click to collapse
I already made a concept of what it could look like with the App Inventor, but I don't mind else:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Note: this is only a English to Latin example. It has to be Latin to English too.
I hope you're able to do it. I'm really bad with linux.
Good luck
http://users.erols.com/whitaker/words.htm is the page for this program. It's written in ada and the author supplies the source. It will probably not be much harder than just compiling it for android once there is a working cross compiler, GNAT AUX is working on one currently http://www.dragonlace.net/posts/GNAT_AUX_ported_to_Android/.
I've searched the web, and found no lynx binaries for android, so I set out to compile it myself.
For the uninitiated, lynx is a text-based browser. No images, no javascript, no flash. Just pure content.
You can use it by connecting to your phone through adb, telnet, ssh or a shell on the phone itself.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This is lynx version 2.8.8 with ncurses 5.9
I pretty much just followed the instructions at http://www.embedu.org/Column/Column294.htm, and added a flag to make the linking static. No code changes were required.
Installation instructions
Root is not required.
You need to unzip the file on the /sdcard folder. The following files must exist:
/sdcard/lynx/lynx.cfg
/sdcard/lynx/lynx.lss
/sdcard/lynx/cache/
Then you need to move the binary to /data/local (or /system/xbin if you want something more permanent. Then you'd need root)
and run this command:
chmod 755 /data/local/lynx
Then run :
/data/local/lynx
and enjoy!
Additional information
If you want to put these files somewhere else, you must redefine the following variables, respectively:
LYNX_CFG (eg: export LYNX_CFG=/system/etc/lynx.cfg)
LYNX_LSS (eg: export LYNX_LSS =/system/etc/lynx.lss)
TMPDIR (eg: export TMPDIR =/cache)
If you receive an error message about the terminal, you need to configure a terminal.
Here are some instruction (for nano, but it works the same)
Sources are at the following addresses:
http://lynx.browser.org/
http://www.gnu.org/s/ncurses/
reserved
soon get the flash-able package
Thanks! I installed this on my ZTE Blade with 2.3.4 Gingerbread, but after setting everything in Terminal Emulator, I get these errors:
Alert!: Unable to connect to remote host.
Looking up lynx.isc.org
Unable to locate remote host lynx.isc.org.
lynx: Can't access startfile http://lynx.isc.org
Click to expand...
Click to collapse
As if there were no internet connection...
Awesome
Will be testing on my thunderbolt later today. I'll let you guys know how it goes.
However, would you mind reposting this on RW, or would you mind if I were to repost it and link back?
[EDIT] In having just configured everything, I also get the error from the post above. It seems as though lynx thinks it doesn't have internet access. This is the case on 3g and wireless networks. Let me know if you want me to test anything for you.[/EDIT]
All the best,
-HG
Looks great.
May I add that to my script ?
http://forum.xda-developers.com/showthread.php?t=1191984
Well, I was able to install it from a chrooted ubuntu 10.10 distro on my device. It's already compiled for ARM on ports.ubuntu.com, so maybe it's not so exclusive.
Sent from my Milestone 2 XDA App
Sure
sebsch1991 said:
Looks great.
May I add that to my script ?
http://forum.xda-developers.com/showthread.php?t=1191984
Click to expand...
Click to collapse
Sure, go ahead. It's open-sourced after all, I just built it.
dangpzanco said:
Well, I was able to install it from a chrooted ubuntu 10.10 distro on my device. It's already compiled for ARM on ports.ubuntu.com, so maybe it's not so exclusive.
Sent from my Milestone 2 XDA App
Click to expand...
Click to collapse
Nice. Can you point me to the correct file? I got as far as http://ports.ubuntu.com/pool/universe/l/lynx-cur/, but I don't know which one contains the binary.
While this is quite cool, why lynx? Why not elinks? It has much better layout capabilities. It has tabs! It even has javascript.
Code:
[email protected]:/# apt-get install lynx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
lynx
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/215kB of archives.
After this operation, 254kB of additional disk space will be used.
Selecting previously deselected package lynx.
(Reading database ... 66275 files and directories currently installed.)
Unpacking lynx (from .../lynx_2.8.8dev.2-1_all.deb) ...
I installed it that way.
Search for opkg (i think this is the name) if you are curious. It's a way of using deb packaging on Android (G1), but not in development anymore...
Sent from my Milestone 2 XDA App
I would be nice if someone could compile the HTTPS version of this so I could browse my banks mobile site
norti said:
Thanks! I installed this on my ZTE Blade with 2.3.4 Gingerbread, but after setting everything in Terminal Emulator, I get these errors:
As if there were no internet connection...
Click to expand...
Click to collapse
any solution ? i got the same problem...
hawkeyexp said:
any solution ? i got the same problem...
Click to expand...
Click to collapse
Can you ping any web address from the shell? What about wget, can you try that?
both pissble without problems
I am getting the following error
Looking up <url>.
Unable to locate remote host <url>
Alert!: Unable to connect to remote host.
Introduction
As I like to stay connected via Putty to my Android phone, from time to time I missed the functionality of updatedb / locate that I so got used to within Linux environment.
I've decided to cross compile the findutils package (I couldn't get the latest version 4.4.2, but an older before, 4.2.33).
Screenshot
You can see the updatedb command followed by some locate commands.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Installation
Busybox is required.
1. Copy the archive onto your /sdcard/ folder.
2. mount your /system folder as read-write
3. cd /system/
4. tar xf /sdcard/findutils-4.2.33.tar.gz
It is mandatory that you are inside /system/ folder when you extract the archive.
Then you have to create the database (using updatedb script). It will take a bit of time - but not too much.
Then you can use the locate command giving any part of a file name that you can remember, you can also use wildcards!
Observations
1. No integration with cron / etc. If you know your updatedb database is out of date, rebuild it using "updatedb"
2. Busybox comes with a /system/xbin/find command. The trouble with it is that it doesn't support the fstype argument, and thus, updatedb cannot prune some standard file system type paths. However, the bundled package here comes with its own find utility which unpacks into /system/bin/find.
3. Busybox is required for sort / sed, but updatedb script is patched to use the /system/bin/find (its own find executable) instead of the default busybox one.
4. My phone did not have an /etc/mtab file (list of mounts which mount is supposed to update whenever something happens). Thus, there is a line in the updatedb script which recreates that file on each updatedb invocation (mount > /etc/mtab). If you phone / tablet has it, please modify updatedb script and remove the mount command.
Download
Use it at your own risk!
findutils-4.2.33.tar.gz
This is great! Thanks for your work!
I hope that there will be a file manager for android which uses updatedb/locate to index/search files in the future, that would be sooooo awesome!
Don't know about other software that searches - but it would be nice too.
Maybe I can create something, but I'm sure there are others more integrated - such as looking in SMSes or in mails too, etc.
nice! find takes for ever lol now i have locate!
Any chance of getting the code. Did you create your own Android.mk? Did you use the FindUtils make?
When I run updatedb, I get these errors:
/system/bin/find: /preload: Value too large for defined data type
/system/bin/find: /storage/sdcard0: Value too large for defined data type
/system/bin/find: /system: Value too large for defined data type
/system/bin/find: /data: Value too large for defined data type
yelkarama said:
When I run updatedb, I get these errors:
... <snip>
/system/bin/find: /data: Value too large for defined data type
Click to expand...
Click to collapse
I also get this error
This doesn't work. Might have worked a couple years ago before 4.x Android...
Use something like es file Explorer
Sent from my SAMSUNG-SGH-I747 using XDA Premium 4 mobile app
I will rebuild it in the weekend I think back in the days the file systems were only 32bit, and now a lot of phones have 64bit file systems ...
viulian said:
I will rebuild it in the weekend I think back in the days the file systems were only 32bit, and now a lot of phones have 64bit file systems ...
Click to expand...
Click to collapse
Thanks for your efforts, I guessed it needed a rebuild from a google, but given how long ago you posted this I didn't think it would happen. Looking forward to the update!
Sent from my GT-N7100 using Tapatalk
Please upload the new build
viulian said:
I will rebuild it in the weekend I think back in the days the file systems were only 32bit, and now a lot of phones have 64bit file systems ...
Click to expand...
Click to collapse
Hi
Please upload the new built binaries.
Thanks
Don't work with Oreo. Please make a update.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Many of you may be familiar with ADB GUI (Or ADB Helper UI). So am I. I always thought it could use something... I don't know... Then, a few days ago, while reading the portal, I read it got an update. So I had a look and downloaded the program. I looked at it, and thought: "Well. It works! But what can I do about it, and how could I make it better? It's missing some tools..."
So then I opened up Visual Studio and coded on. I spent an entire day working out the design and how it should work and what features it should have. I had no internet at the time (Change of ISP) so I then coded and coded and coded until it was bed-time. The next day I started coding and wasn't sure about the design, so I deleted the code, got rid of the project and started anew. And the results aren't too bad!
So today I am proud to present to you, Better ADB GUI!
It's still very early and almost nothing works, but I want to show it off and release the current source code.
Screenshots
Features
Install ADB to system (Natively, like in other projects of mine)
Install and uninstall apps
Push files to Android device
Pull files from Android device
Backup device
Restore device
Reboot system; system, recoery, bootloader|Fastboot
Show/Save logcat to device
Show DMESG
Sync dirs
Start ADB shell
Root ADB shell (Restarts ADBD deamon with root rights)
Open CMD
Remount system
Restart ADB
Install SuperSU by Chainfire (x86, arm)
Uninstall SuperSU (x86, arm)
Install SuperSU (by @Koush)
Uninstall Super User (by @Koush)
Install busybox (App by stericson)
Install busybox (App by Stericson) as root/system app
Uninstall busybox (App by Stericson)
Install busybox binary (Requires custom kernel)
Uninstall busybox binary (Requires custom kernel)
There is other stuff, but it's still being coded.
What doesn't work
Everything that isn't up there ↑
Coded in(...)
This program is coded in Visual Basic 2010 (Upgrading to 2012 soon, as my laptop is broken and the one I'm using is REAL bad.)
Uses(...)
The app uses following libs/apps:
AndroidLib (Forgotton by whom. Sorry!)
Custom libs (Usedin Universal Android Toolkit)
Odin 4.22 (Thanks to Samsung!)
ADB, fastboot, AdbWinApi.dll, AdbWinUsbApi.dll (Thanks to Google!)
SuperSU, SuperSU binaries (x86 and arm), SuperSU no-nag (Many thanks to @Chainfire!)
Busybox (Thanks, @Stericson!)
Super User (Thanks to @koushikdutta)
7z.exe, 7z.dll (Thanks to some Igor bloke!)
Anything else has yet to be added...
LINKS:
Better ADB GUI Repository
No download link, yet. Will be available with first release.
Don't forget to enjoy the program! If you like what you see, please do contribute to the project, or help me save up for a nice, new PC (Links in program and description).
Stay awesome, guys!
#1
Reserved post #1
#2
Reserved post #2
#3
Reserved post #3
Last one. Promise
Reserved post #4
Woe it looks awesome but When you gonna release it? Cant see any download link yet ..
H4CK_H0PP3R said:
Woe it looks awesome but When you gonna release it? Cant see any download link yet ..
Click to expand...
Click to collapse
Well, as sad as it is, I don't code in VB anymore, and I especially don't use Windoze anymore.
So, any functionality that is found here, will:
a) Be also incorporated into my much older project Universal Android Toolkit - which will be coming very soon
or
b) Will be ported to Java for use with Windoze (Universal Android Toolkit is mutating to a BSD/BSD-like OS-only program, because we've go way to little of these.
But, you can pull the source and try it out for yourself. I can't remember what's working and what isn't, but hey. There should be a working build in thre somewhere, and you should be able to carry on maintaining it.
Hello Friends~!
I decided to play with some forks of android and chrome os in vmware this week, it was a lot of fun!
A problem I would like to create a solution for, is the inability for vmware tools to install natively.
Here is a toolset I prepared called "droidvmtools" DOWNLOAD
I was able to create this toolset based off of the prelGlibc25 Linux iso that came with VMWare, that is stored in Windows in this directory:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
If you care about the extra steps added to "droidvmtools" I tried to document that process HERE
This exercise is performed using this Prebuilt copy of PrimeOS for VMWare DOWNLOAD
In theory, this method should work on other android images with root access, then likely fail as this example does at the end.
INSTALLATION:
Obtaining the perl binaries:
In termux run the command
Code:
pkg install perl
Then in Root Explorer, go to
Code:
/data/data/com.termux/files/usr/bin
and copy the perl binaries.
Now paste the binaries to:
Code:
/system/bin
To install the Toolset:
Extract droidvmtools and paste it to the root file system. The video goes over this step at 2:34 if you need reference. ( I also used my yt channel to easily dl the tools youtube.com/@jennn/about the tools are there if no usb)
Open a terminal emulator and type:
Code:
su
chmod 777 -R /droidvmtools
Then in Root Explorer, open droidvmtools, select all, copy, and then paste the contents to the root file system
You will be prompted with this message, select these options:
Now when you type:
Code:
perl run.pl
The tools are able to start installation but they crash at this part:
This is the part I am stuck on. I had never heard of recursion until this happened..
Here is a PASTEBIN dump of the code, maybe someone is able to look and see why this would be happening?
This thread is in preparation for a megathread I want to make. If you want to preview some of the images early see HERE
PLEASE NOTE:
I Understand that "Vmware Tools is not supported" in Linux let alone Android, blah blah. Let's try!
I also already know about and have tried every emulator in existence... So Please! Let's refrain from "just use x emulator", this is about problem solving.