Building a DOS .bat file that will root my Droid 2 phone using adb


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Building a DOS .bat file that will root my Droid 2 phone using adb
# 1  
Old 11-27-2010
Data [Solved] Building a DOS .bat file that will root my Droid 2 phone using adb

1. What I am doing?
Building a DOS .bat file that will root my Droid 2 phone using adb commands in the .bat file. (Just for the fun of it and to help me learn "stuff".)

2. Problem:
Here are the problem steps to accomplish this task manually in an adb shell:
adb shell (Prompt is $)
cd data/local/tmp
chmod 0755 rageagainstthecage-arm5.bin
./rageagainstthecage-arm5.bin (then WAIT!!)
Ignor remarks in parentheses.
(there are many other steps, but they all work no problem in the .bat file.)

In the .bat file this is what I have:
adb shell "chmod 0755 /data/local/tmp/rageagainstthecage-arm5.bin"
echo Installing Rageagainstthecage
adb shell "cd /data/local/tmp/;./ rageagainstthecage-arm5.bin"
pause
adb wait-for-device
adb devices

This line: adb shell "cd /data/local/tmp/;./ rageagainstthecage-arm5.bin" looks like it is working because the .bin file prints about 7 lines telling you to wait till you reset back into your dos environment.

In manual mode the cursor blinks for a few seconds, then the dollar sign comes up, then after a few more seconds the prompt changes to C:\users\a at which time you go into a shell get the # cursor, mount the system rw, push more files to directorys on the phone and change permissions and finally mount the system ro.

In manual mode after the $ comes back the phone will reset and reboot.
In the .bat file I get no $ (well, I can not see so that is why I placed the pause in there, but if the pause is working I have already exited the shell and the next command executes and everything after that fails because I can not mount rw,
because the rage....bin either has not finished or did not run correctly because the phone does not reset/reboot.

If it works manually, it should work in a script, if ya know what to "say".

I have goggled around for 3 days and learned about "source" ".script", ". ./script and other things that are over my head like: cd "$(dirname "$(type -p "$0")")".
I someone could explane the "$(dirname "$(type -p "$0")")" ??

As a matter of fact, most of the errors say "syntax error 1.word expected expecting )")" .
Or when I use source I get "Permission denied"

So do I need to add a semicolon with the chmod command between the cd bla bla and the ./ or source.

I am required to have my phone in "PC Mode" and "USB debugging enabled". Both are set properly.

Thanks for any advice.
# 2  
Old 11-29-2010
I got it and now everything works fine!
adb shell "./data/local/tmp/rageagainstthecage-arm5.bin & sleep 300;kill $!"
echo Reconnecting in 20 sec...
adb kill-server

adb start-serve
# 3  
Old 11-29-2010
Thanks for keeping us informed and giving your solution... (changed the title...)
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

DOS bat file to add to path

This may not be the right place, since it is not exactly unix or linux, but it does involve cygwin. I have two cygwin installations. When I start a mintty terminal, I need to toggle a windows path variable to make sure that the correct cygwin dll gets loaded. I need to add C:\cygwin\bin to the... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

2. Shell Programming and Scripting

Need help with bat file!!!

I need to put/get files from Windows machine to Unix machine and vice-versa. I wrote a text file "ftp1.txt" as below. naga naga06 cd /root/Naga prom off get time.unl bye I wrote another bat file "ftp.bat" as below. ftp -n -s:C:\Users\Naga\Desktop\ftp1.txt IP_ADDRESS but... (2 Replies)
Discussion started by: Naga06
2 Replies

3. Windows & DOS: Issues & Discussions

Executing .bat file

Hi , I have a bat file on windows machine ,I need to excute it from my local unix machine using sambe utility.Is there any comman to execute the .bat file remotely. Using samba utility i can post files to and fro from windows to unix but i don't comman to exute the .bat file. can any one... (2 Replies)
Discussion started by: Raamc
2 Replies

4. Shell Programming and Scripting

Building a script in Ubuntu (Linux) from existing DOS .cmd

Greetings, I would be very grateful to anyone who is willing to help and knows there scripting and how to convert a DOS CMD script. :) In this posting I am also hoping to pass on information to anyone wanting to see a bit of VMware command line stuff. I have made a script (batch file) that runs... (11 Replies)
Discussion started by: dp123
11 Replies

5. Shell Programming and Scripting

Run cygwin in .bat file

Hello everyone, I've written quite a few AWK scripts to run in cygwin and now, I would like to run them one after the other in a .bat file. The problem is, I tried modifying the .bat file used to run cygwin in the first place, but whenever I change something, it doesn't work. The PATH is set up... (3 Replies)
Discussion started by: Teroc
3 Replies

6. Shell Programming and Scripting

Simple bat file

Hi guys, I need a *.bat to run a ksh file in the shell on Windows NT...nothing more :) How do I do it? I tried with the following but it failed: set INFORMIXDIR=D:\user-applications\informix set PATH=%INFORMIXDIR%;%PATH% D:\user-applications\MKS\mksnt\sh.exe C:\hk_9.2\C3_weekly_auto.ksh... (4 Replies)
Discussion started by: Dird
4 Replies

7. Windows & DOS: Issues & Discussions

one question for .bat file

Hi! I'm very sorry for such simple and silly question but I cannot answer it by myself. Can you please help me? In .bat file I should run the C program which is in other directory, and the input configuration file is in this directory too. This dir name is in dirRun variable. The... (3 Replies)
Discussion started by: Anta
3 Replies

8. Windows & DOS: Issues & Discussions

Need solution for Bat FIle using FOR Cycle

Hi people. Don't know if you could help me, but here it goes anyway. I need to search for some directories, and if i for any file founded a must run another Bat file. Can this be done in DOS ? Thanks in advance (1 Reply)
Discussion started by: osramos
1 Replies

9. UNIX for Dummies Questions & Answers

Can Unix (Solaris) execute a dos .bat script?

I did a search and found lots of questions/comments about how a dos script could execute Unix but not the other way round. If it's possible, I'd like the link to a post/site that would show me the way. Thanks. (4 Replies)
Discussion started by: BCarlson
4 Replies
Login or Register to Ask a Question