Need directions about scripting

Discussion in 'Motorola Droid 2 Development' started by chrstdvd, Dec 12, 2010.

  1. chrstdvd

    chrstdvd Member

    Sep 30, 2010
    Likes Received:
    Trophy Points:
    McKenney Va
    I am practicing writing scripts. I decided to take the instructions form:
    and put them in a script on the emulator on my phone.

    I can enter the steps one at a time on the phone and everything goes well.

    When I am rooted, I can write a script for the unroot part in the /tmp folder chmod to 755 and ./ run it. After reboot the phone is unrooted but my script is no longer in the /tmp folder. Where do I need to put it to always have it available?

    When I am un rooted and write the script to root, it will not work from /tmp or from /data/local/tmp. I thought for sure since we push rage*.bin into /data/local/tmp, chmod it, and ./ it, I could do the same with my script. My script will not run rage from either of these folders, I get "permission denied" or "can't open" or "no such file or directory." I have tried ./rage, .rage, and sh rage.

    If I ever get rage to run from a script then there is the part when it is done where you have to go kill the emulator. I can not figure out how to do that from a script, so I guess, I will have to write another script to finish off the process after I manually kill the emulator and restart it.

    Another aggravating thing for me is when unrooted using Root explorer I can not cd to data/local/tmp and ls, but if I hook up the the computer and use adb to open a shell, I can cd to any folder on the phone and ls ,to see what files are in the folder.

    I guess I am asking, "How do I write a script and place it in /system/bin or system/app and run it like any other command?"


    Update: I found this link using Google:
    I went into /system/xbin and wrote the script to unroot the phone, chmod, and the exited the emulator. I re-entered the emulator, su'ed typed "unroot" and it worked like a charm. After reboot (turn phone off /back on) I was unrooted and all the files were gone. COOL! Then to check, I used z4root and rooted again and then unrooted all over. Worked great that time too. Part one is done. Now on to part 2.

    Update 2: I got it! I wrote a script, root, that installed rage, then one root2 both in system/xbin chmod'ed them 0755 left the emulator, went back into emulator and typed "unroot" and and then the phone was unrooted. Next I turned off the phone and back on to verify I was unrooted. Next, I went into emulator and typed "root" and rage installed. Then I went into settings>applications>manage apps> running and force closed terminal emulator. Went back into emulator, had the # sign prompt typed "root2" and it ran. Then I typed "reboot" the phone rebooted into Droid 2 bootstrapper just like when I use the z4root and I clicked on "reboot" and she is rooted again.

    If anyone wants I will zip them up and post them on here, but I have scripts sysrw and sysro (to mount rw and ro) on my phone so, anyone who uses root and unroot scripts will need those files installed on their phone in /system/bin.
    #1 chrstdvd, Dec 12, 2010
    Last edited: Dec 12, 2010
Search tags for this page
android script writing
android terminal emulator run script

android terminal emulator scripts

how do u write a script on a droid x2
how do you write scripts for terminal emulator work
running script on unrooted android

scripts for android terminal emulator

shell script ls android