What is wrong with my script - going crazy - Android Software/Hacking General [Developers Only]

so I'm new to scripting, and I have a TON of lg optimus S's to root for work. So I figured I'd write a script to make life easy. I know all the shell commands are correct as if I manually type everything in it works. What happens is it gets through gingerbreak exploit and when the prompt returns # - everything seems to go to hell.
Here is my script I am using. I'm using Kubuntu 11.04 writing it in Kate, name of my script is Script2 and I'm executing it in bash via $sh Script2
echo "removing TMP directory";adb shell rm -r /data/local/tmp
echo "creating TMP directory";adb shell mkdir /data/local/tmp
echo "pushing gingerbreak";adb push gingerbreak /data/local/tmp/gingerbreak
echo "CD TMP";adb shell cd /data/local/tmp
echo "CHMOD TMP";adb shell chmod 777 /data/local/tmp/*
echo "running gingerbreak";adb shell /data/local/tmp/gingerbreak &
sleep 32
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock5 /system
adb shell cat /sdcard/flash_image > /system/bin/flash_image
adb shell chmod 755 /system/bin/flash_image
adb shell mount -o remount,ro -t yaffs2 /dev/block/mtdblock5 /system
adb shell flash_image recovery /sdcard/xionia_cwma_12518.6.img
adb shell reboot recovery
I've tried with out sleep command and also with out "&" at the end of gingerbreak, and when I do that and it returns # it seems like no commands will work, even if I type them in it returns just a blank line with out #.
With that current script after sleep 32, it returns #, few seconds later it tries to mount and I get (including the end of gingerbreak exploit).
[!] dance forever my only one
# mount: Operation not permitted
Script2: 9: cannot create /system/bin/flash_image: Directory nonexistent
Unable to chmod /system/bin/flash_image Read-only file system
mount -o: permission denied
reboot: Operation not permitted
then it returns me to bash$
Thanks!

So something interesting, I've been playing with this for awhile, and I took everything out past the
adb shell /data/local/tmp/gingerbreak
it seems if I run it as
bash$ adb shell /data/local/tmp/gingerbreak
vs
bash$ adb shell
$ cd /data/local/tmp
$ ./gingerbreak
when # is returned, the first option won't take any commands its like it hangs, if I type out the next command it will just return a blank line with out $ or #, I have to forcibly end the process by CTRL+C and it will return me to bash, if I do the second option it works and I can enter the next command in and it takes and returns me to #. Anyone know why this is? I'm pretty sure this is the problem.
I would happily use the second option, but I'm not sure how to get the script to take any android shell commands without a "adb shell" infront. If anyone knows how to get around this, that would be awesome =)

Related

need help to make a rom kitchen for sg3

hi guys,i'm working for make a rom kitchen for our sg3 those days
it's 40% done,but i have some troubles
i can't root via this script,can you help me?
this is my code:
Code:
adb push .\root\rageagainstthecage /data/local/tmp/rageagainstthecage
adb push .\root\Superuser.apk /data/local/tmp/Superuser.apk
adb push .\root\su /data/local/tmp/su
adb push .\root\busybox /data/local/tmp/busybox
adb shell chmod 755 /data/local/tmp/busybox
adb shell chmod 755 /data/local/tmp/rageagainstthecage
adb shell "/data/local/tmp/rageagainstthecage"
adb kill-server
adb start-server
adb -d shell "mount -o remount,rw /dev/block/stl9 /system"
adb push .\root\su /system/bin/su
adb push .\root\busybox /system/bin/busybox
adb push .\root\sqlite3 /system/bin/sqlite3
adb push .\root\Superuser.apk /system/app/
adb shell "/system/bin"
adb -d shell "chmod 4755 su"
adb -d shell "chmod 4755 busybox"
adb -d shell "chmod 4755 sqlite3"
maybe it's complicate, i tried many times to mod it,but no result.
i run it ,it goes to
adb -d shell "mount -o remount,rw /dev/block/stl9 /system"
this line ,says ‘mount :operation not permitted ’
and it still $ instead of #
i do not know where the problem is ...
plz help me
hi pls their are two tutorials on this subject pls ask ur question in one of the threads
CLOSED
and my base version is ZHJPF
i think u need to su to remount system as rw.

[Q] adb push- why am I getting permission denied?

phone: LG esteem ms910
Rooted: Yes
I'm trying to adb push a .apk file into my phones /system/app folder. These are the steps I am taking in trying to do this, but I am getting a permission denied response at the "adb push" part. Oh and my phone is under the "internet connection" setting. The other two (mass storage, charge only) wont let my phone enter debugging mode.
Code:
adb shell
su
mount -o remount,rw /dev/block/stl9 /system
exit
exit
adb push C:\Myfile.apk /system/app
Also when I enter the "mount -o remount,rw /dev/block/stl9 /system" command, It pops up twice but without the # symbol, not sure if there is an error there but it ends up looking like this:
Code:
C:\Android\android-sdk\platform-tool>adb shell
$ su
# mount -o remount,rw /dev/block/stl9 /system
mount -o remount,rw /dev/block/stl9 /system
# exit
exit
$ exit
exit
C:\Android\android-sdk\platform-tool>
I think you would want it to be on charge only, as the other options are utilizing the USB while charge only does not. That is how my setup functions... I did have the permission denied error before when I was using Ubuntu 10.04. Are you sure you have an up to date version of JDK? And the USB rules?
your command should be
adb push C:\Myfile.apk /system/app/myfile.apk
you have also to run adb as root or enable rw for /system/app
Basically:
______________________________________________
adb shell
su
mount -o remount,rw /dev/block/stl9 /system
chmod 777 /system/app
exit
exit
adb push C:\Myfile.apk /system/app/myfile.apk
________________________________________________
should do the job
@imheroldman- I tried leaving it on charge only, but the devices wasnt found when I ran the adb devices command, and yes the JDK is the latest.
@djodjoni -Hey I tried your suggestions and it worked.
Thanks to the both of you for helping.
FWIW, I got permission denied errors when I tried to push busybox via adb. I just downloaded a busybox .zip and flashed it via TWRP, it seems to have worked, and the busybox app recognizes it as installed.
I can't use adb push. It says Read Only file system when I try to push things to /sdcard. Don't know why
kavinzhao said:
I can't use adb push. It says Read Only file system when I try to push things to /sdcard. Don't know why
Click to expand...
Click to collapse
Use this:
Code:
[path] > adb shell
# mount -o rw,remount rootfs /
# chmod 777 /sdcard
# exit
[path] > adb push [file path on your PC] /sdcard
ИΘΘK¡€ said:
Use this:
Code:
[path] > adb shell
# mount -o rw,remount rootfs /
# chmod 777 /sdcard
# exit
[path] > adb push [file path on your PC] /sdcard
Click to expand...
Click to collapse
Thanks. I was using the recovery to receive before this. I think that should save me some time.
hello, I am having same problem, can you please help me out?
[email protected]_himaulatt:/data/local # adb push C:\firewater /data/local/temp
adb push C:\firewater /data/local/temp
error: device not found
1|[email protected]_himaulatt:/data/local # adb push C:\firewater /data/local/
adb push C:\firewater /data/local/
error: device not found
1|[email protected]_himaulatt:/data/local # adb push C:\firewater /data/l
adb push C:\firewater /data/l
error: device not found
1|[email protected]_himaulatt:/data/local # adb push C:\firewater /data/
adb push C:\firewater /data/
error: device not found
1|[email protected]_himaulatt:/data/local # cd ..
cd ..
[email protected]_himaulatt:/data # cd ..
cd ..
[email protected]_himaulatt:/ # exit
exit
[email protected]_himaulatt:/ $ exit
exit
C:\Users\Winpc\Downloads\fastboot-win>adb push C:\firewater /data/local/temp
failed to copy 'C:\firewater' to '/data/local/temp/firewater': Permission denied
C:\Users\Winpc\Downloads\fastboot-win>adb wait-for-devices push firewater /data/local/temp
failed to copy 'firewater' to '/data/local/temp/firewater': Permission denied
C:\Users\Winpc\Downloads\fastboot-win>adb shell
[email protected]_himaulatt:/ $ su
su
[email protected]_himaulatt:/ # mount -o rw,remount rootfs/
mount -o rw,remount rootfs/
Usage: mount [-r] [-w] [-o options] [-t type] device directory
1|[email protected]_himaulatt:/ # mount -o rw,remount rootfs /
mount -o rw,remount rootfs /
[email protected]_himaulatt:/ # chmod 777 /sdcard
chmod 777 /sdcard
[email protected]_himaulatt:/ # exit
exit
[email protected]_himaulatt:/ $ adb push C:\firewater /data/
adb push C:\firewater /data/
error: device not found
1|[email protected]_himaulatt:/ $ exit
exit
C:\Users\Winpc\Downloads\fastboot-win>adb wait-for-devices push firewater /data/local/temp
failed to copy 'firewater' to '/data/local/temp/firewater': Permission denied
C:\Users\Winpc\Downloads\fastboot-win>
Make sure you have phone detected and correct drivers and adb installed.
Once ADB is functioning properly, then let's PUSH files!
First let's make sure adb is running and make sure adb see's the phone. Please run these commands:
Code:
adb kill-server
adb start-server
adb devices
The output after devices will be a serial number, if this looks good, move on. First you need to make
sure the apk you want to push is in the same directory as adb.exe
once you have moved the apk to the adb.exe directory, then run the following:
Code:
[FONT=Verdana]adb remount
adb push myfile.apk /system/app/
adb shell chmod 644 /system/app/myfile.apk
adb reboot[/FONT]
adb remount mounts the phone as read write so you can write thru adb, it will be automatically unmounted when phone disconnected or rebooted
assuming your APK you want moved is called "myfile.apk"
adb push file_myfile.apk /system/app/ this command moves the "myfile.apk" (the apk you want moved) to the /system/app/ directory on your phone
adb shell chmod 644 /system/app/myfile.apk this command sets the correct file permissions for APKs
adb reboot this reboots the phone so that the new apk can be detected
Good luck
hi:
phone is rooted;
android 5.0 ;
adb start-server is OK;
adb devices is OK;
adb root is adbd is already running as root;
system and system/app are "chomd is 777 ";
I want to "adb push myfile /system/app/ "
Question: Permission denied .
- -
thx
other:
adb remount is Permission denied too.
"adb push ./build.gradle /storage/sdcard0/ " is OK.
opalescent said:
hi:
phone is rooted;
android 5.0 ;
adb start-server is OK;
adb devices is OK;
adb root is adbd is already running as root;
system and system/app are "chomd is 777 ";
I want to "adb push myfile /system/app/ "
Question: Permission denied .
- -
thx
other:
adb remount is Permission denied too.
"adb push ./build.gradle /storage/sdcard0/ " is OK.
Click to expand...
Click to collapse
sounds like you possibly do not have proper permission for the user you are logged into your computers operating system with. make sure you have the proper permissions and rights to access the folders you are trying to access. For a quick fix you can try loging into the system using the root user or administrator of the system that you are using and then try the adb commands. and you can just do a quick su switch from the Computer OS's konsole/terminal.
XeoNoX said:
First you need to make sure the apk you want to push is in the same directory as adb.exe
Click to expand...
Click to collapse
OMG thanks, mine wasn't working because something as simple as that!

[Q]How to access android FS form fastoot/flashmode

I have copyied a damaged file in /system/app folder and now my phone is in the Bootloop. I wanna acces that file and replace it with the original. Can I do that?
I managed to solve it by deleting the 2 damaged files with this piece of code
Code:
echo " "
echo "Waiting for device..."
adb wait-for-device
echo " "
adb -d shell su -c "mount -o rw,remount /system"
adb -d shell su -c "ls /system"
adb -d shell su -c "rm /system/app/AudioEffectService.apk"
adb -d shell su -c "rm /system/app/SoundEnhancement.apk"
(of course the boot-loop forced me to find the right moment in the boot sequence to run the script)

[Q] Help! Problem with Tablet Olidata WB7-l

Hi! I'm a noob user, with a weird tablet.
The brand is Olidata (Chile), and the model is Wb7-l. The first problem was that the tipycal: many worng pattern attempts. I though about the usual: hard reset, but this weird tablet doesn't have one!So I tried all button combinations to enter th the hard reset menu, but was unuseful.
Then, I found a post, it said that with a program I could put anoter ROM (PhoenixSuite), and with the ADB Drivers. I could put another ROM, but the touch system doesn't work. Then I searched a second and a Third ROM, but was the same. Then, I remembered that the chip was a A13, and I found another post, where a user said that with a script you could fix that problem. I use the script and... it died :crying: . After that, i tried to connect it to the computer again, but I couldn't.
THEN, i read the script. Now, i'm really really afraid, because maybe the Tablet is dead.
Here's the script:
(I open it with notepad)
@ECHO off
echo Remount
adb remount
adb shell cd /
echo Mount root
adb shell mount -o remount,rw -t ext4 /dev/root /
echo Make dir bootfs
adb shell mkdir bootfs
echo Mount bootfs
adb shell mount -t vfat /dev/block/nanda /bootfs
echo Copy script.bin
adb push "script.bin" /bootfs/script.bin
echo Copy script0.bin
adb push "script.bin" /bootfs/script0.bin
echo Copy zet6221.ko to /system/vendor
adb push "zet6221.ko" /system/vendor/zet6221.ko
adb shell chmod 644 /system/vendor/zet6221.ko
echo Copy zet6221_ts.idc to /system/usr/idc
adb push "zet6221_ts.idc" /system/usr/idc/zet6221_ts.idc
adb shell chmod 644 /system/usr/idc/zet6221_ts.idc
echo Copy preinstall.sh
adb push "preinstall.sh" /system/bin/preinstall.sh
adb shell chmod 755 /system/bin/preinstall.sh
echo Copy setupsensors.sh
adb push "setupsensors.sh" /system/bin/setupsensors.sh
adb shell chmod 755 /system/bin/setupsensors.sh
pause
adb shell reboot
How can I undo what I did? What's the right ROM? (The other one was one called F1(A13)-20121129.1.1.1- )
Please, please help
(Sorry for my weird english, I know just a bit )

[Completed] [Q] Batch file commands help

So I am trying to make a batch file that automatically flashes a custom bootanimation from my computer and I am having trouble with these commands.
adb wait-for-device shell "su -c 'ls /system/media'"
adb wait-for-device shell "su -c 'mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system'"
adb wait-for-device shell "su -c 'rm /data/media/bootanimation.zip1'"
Bascially I want to have the adb shell enter superuser mode, remount system in read write mode and delete the existing bootanimation.zip
Whenever I try and run this it says permission denied.
Please post your question in Android General so that the right experts may be of help.
Thread Closed. Thank you.

Categories

Resources