Hi,
I have idea like "backup all data (include apps, accounts, system settings) -> wipe all data -> upload backup -> start device", but backup upload on server by ftp/sftp.
After few times another script download necessary backup and upload on phone by adb/fastboot and start device.
Now i create backup by this script (sorry, i`m only learn)
Code:
adb wait-for-device
set dirname=%date:~0,2%%date:~3,2%%date:~8,2%%time:~0,2%%time:~3,2%
mkdir %dirname% > NULL
adb shell su -c "dd if=/$(ls -la /dev/block/platform/msm_sdcc.1/by-name | grep system | sed -r 's/.* .//') of=/sdcard/blkbackup.img"
adb pull /sdcard/blkbackup.img %dirname%\system.img
adb shell rm /sdcard/blkbackup.img
adb shell su -c "dd if=/$(ls -la /dev/block/platform/msm_sdcc.1/by-name | grep boot | sed -r 's/.* .//') of=/sdcard/blkbackup.img"
adb pull /sdcard/blkbackup.img %dirname%\boot.img
adb shell rm /sdcard/blkbackup.img
adb shell su -c "dd if=/$(ls -la /dev/block/platform/msm_sdcc.1/by-name | grep recovery | sed -r 's/.* .//') of=/sdcard/blkbackup.img"
adb pull /sdcard/blkbackup.img %dirname%\recovery.img
adb shell rm /sdcard/blkbackup.img
adb shell su -c "dd if=/$(ls -la /dev/block/platform/msm_sdcc.1/by-name | grep cache | sed -r 's/.* .//') of=/sdcard/blkbackup.img"
adb pull /sdcard/blkbackup.img %dirname%\cache.img
adb shell rm /sdcard/blkbackup.img
adb shell su -c "dd if=/$(ls -la /dev/block/platform/msm_sdcc.1/by-name | grep userdata | sed -r 's/.* .//') of=/sdcard/blkbackup.img"
adb pull /sdcard/blkbackup.img %dirname%\userdata.img
adb shell rm /sdcard/blkbackup.img
adb shell "pm list package -s" > %dirname%\system.apps.list
adb shell "pm list package -3" > %dirname%\3d-party.apps.list
i think what this logicaly work, but in realy - dont work and i cant upload backup in server.
can you explain me how i can create fully backup android device and restore it adter few days in device by shellscript.
In an ideal world I see it this way:
1) made a backup using http://forum.xda-developers.com/showthread.php?t=1620255
2) loading on server
3) another script download the desired backup and load it on your phone or PC
4) install
4.1) profit
PS Since I need it urgently enough and I tried huge amount of scripts and commands - asking for your help (in debt will not stay).
PPS ubuntu
Skype: a.roman2403
Related
Need help to write batch script to run on windows. The command one by one goes smoothly. i`d like to have one *.bak file to run all these at once.
Here are basically commands that needs to be performed:
adb shell
su
mount -o remount,rw /dev/null /system
cd system/app
rm SprintZone.apk
rm Sprint_Installer.apk
rm W_Installer.apk
rm sprintextension.apk
cd /data/app/
rm com.sprint.widget.tutorial-1.apk
Thanks for help!
tigran80 said:
Need help to write batch script to run on windows. The command one by one goes smoothly. i`d like to have one *.bak file to run all these at once.
Here are basically commands that needs to be performed:
adb shell
su
mount -o remount,rw /dev/null /system
cd system/app
rm SprintZone.apk
rm Sprint_Installer.apk
rm W_Installer.apk
rm sprintextension.apk
cd /data/app/
rm com.sprint.widget.tutorial-1.apk
Thanks for help!
Click to expand...
Click to collapse
I have an easier solution for you that doesn't even require adb or a pc.
1. Download the shell script I from my dropbox here
2. Copy it to a folder on your phone where you can easily find it
3. Go to the market and download GScriptLite
4. Use GScriptLite to navigate to the folder where you put the script I attached
5. Use GScriptLite to run the script (If it asks for root allow to run as root)
6. Done
Hope this helps
shimp208 said:
I have an easier solution for you that doesn't even require adb or a pc.
1. Download the shell script I from my dropbox here
2. Copy it to a folder on your phone where you can easily find it
3. Go to the market and download GScriptLite
4. Use GScriptLite to navigate to the folder where you put the script I attached
5. Use GScriptLite to run the script (If it asks for root allow to run as root)
6. Done
Hope this helps
Click to expand...
Click to collapse
thanks for reply. but the point is to avoid using market and phone at all. just install required apps and apks with adb.
tigran80 said:
thanks for reply. but the point is to avoid using market and phone at all. just install required apps and apks with adb.
Click to expand...
Click to collapse
Wasn't aware of that in that case try this:
1. Create a new batch file with these commands in it
Code:
adb shell su -c
adb shell su -c "mount -o remount,rw /dev/null /system"
adb shell su -c cd system/app
adb shell su -c rm SprintZone.apk
adb shell su -c rm Sprint_Installer.apk
adb shell su -c rm W_Installer.apk
adb shell su -c rm sprintextension.apk
adb shell su -c cd /data/app/
adb shell su -c rm com.sprint.widget.tutorial-1.apk
adb shell su -c reboot
2. Save the batch file
3. Before running it open a terminal window where your sdk tools are located
4. Execute the script
script.sh
Code:
#!/system/bin/sh
su
mount -o remount,rw /dev/null /system
cd system/app
rm SprintZone.apk
rm Sprint_Installer.apk
rm W_Installer.apk
rm sprintextension.apk
cd /data/app/
rm com.sprint.widget.tutorial-1.apk
script.bat
Code:
@echo off
adb shell<script.sh
i have similar problem
fix.bat
Code:
::writable(mount writable)
adb shell < scripts/writeable.sh
::apps remower
adb shell < scripts/mdmkaldir.sh
::dnsconf change
::starting problem here file cant owerwrite.
adb push 20-dns.conf system/etc/dhcpcd/dhcpcd-hooks
::system readonly
adb shell < scripts/readonly.sh
::needed apks
::how i can isntall system app filemanager only
adb install apps/com.rhmsoft.fm-1.apk
adb install apps/com.buak.Link2SD.apk
adb install apps/uk.co.mytechie.setDNS.apk
::(root change)
adb install apps/eu.chainfire.supersu-minAPI7.apk
PAUSE
adb reboot
mdmkaldir.sh
Code:
su
cd system/app
rm EBAMarket.apk
rm EBA_SSO.apk
rm TR_Soft_Keyboard_default.apk
rm FatihMDM_ibnisina.apk
rm MpTest.apk
rm MpTest.odex
rm MpTestGps.apk
rm MpTestGps.odex
exit
exit
writable.sh
Code:
su
mount -o remount,rw /system
exit
exit
please help for this script
adb push 20-dns.conf system/etc/dhcpcd/dhcpcd-hooks
this line not work please help.
adb push 20-dns.conf system/etc/dhcpcd/dhcpcd-hooks
what is wrong please help
Before 4.0 and 4.0
* Need IT's Rooted Device *
1. adb shell su -c "mount"
2. adb shell su -c "cat /proc/mtd
Now show list of your system img where stay
example : boot.img = /dev/block/mtdblock7
so you can pull out from there .. here ..
3. adb shell su -c "chmod 777 /dev/block/mtdblock7"
4. adb shell su -c "dd if=/dev/block/mtdblock7 of=/storage/sdcard0/boot.img"
(of=/storage/sdcard0/ .. this location may b change you can look at "mount" )
-----------------------------------------------------------------------------------------
After 4.1 or mmc
1. adb shell su -c "mount"
2. adb shell su -c "cat /cache/recovery/last_log"
Now show list of your system img where stay
example : boot.img = /dev/block/mmcblk0p7"
so you can pull out from there .. here ..
3. adb shell su -c "chmod 777 /dev/block/mmcblk0p7"
4. adb shell su -c "dd if=/dev/block/mtdblock7 of=/storage/sdcard0/boot.img"
(of=/storage/sdcard0/ .. this location may b change you can look at "mount" )
For someone dont' know
thanks all ...
I can't find any info on whether or not it's imperative , or possible to back up efs on this device. I typically always back them up when I am rooted bc it's my biggest fear in somehow getting corrupted or lost, and not having anyway to restore. There doesn't seem to be a topic anywhere on These boards (DNA) so I'm thinking it's either impossible to lose or very easy to restore lol. Anyone know for Sure ?
adb shell su -c "cat /proc/partitions"
adb shell su -c "cat /proc/emmc"
adb shell su -c "mkdir /sdcard/img"
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/mmcblk0p18 of=/sdcard/img/radio_config.img"
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/mmcblk0p22 of=/sdcard/img/modem_st1.img"
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/mmcblk0p23 of=/sdcard/img/modem_st2.img"
mkdir efsbak
adb pull -p /sdcard/img/radio_config.img .\efsbak
adb pull -p /sdcard/img/modem_st1.img .\efsbak
adb pull -p /sdcard/img/modem_st2.img .\efsbak
I am trying to make a simple shell script and I am getting constant errors.
So i made a test.sh file and saved it in /data because /sdcard is excuetable protected.
The shell file contains:
#!/system/bin/sh
su -c "cd /data"
su -c " ls /data"
su -c "mkdir test"
cd /sdcard
mkdir test
echo Done!
So then I typed the command chmod 777 /data/test.sh
And then /data/test.sh and it returned: tmp-mksh: /data/test.sh: No such file or directory
So then I tried running: sh /data/test.sh and it returned:
No such file or directoryrd
Done
I also tried using 755 in the chmod command and it did not work as well. I also tried chown root:shell /data/test.sh
I even moved the shell script to /data/local/tmp and tried there but still no luck.
So I have 2 questions, how do I get my shell script to work and how do I run a command as superuser in a shell script?
i cant install su in system i test all many option and still cant please tell me
stargam said:
i cant install su in system i test all many option and still cant please tell me
Click to expand...
Click to collapse
Try this
Code:
adb devices
adb disable-verity
adb reboot
adb devices
adb shell "mkdir -p /data/local/tmp > 2/dev/null"
adb push c:\su /data/local/tmp > nul
adb shell "chmod 0777 /data/local/tmp/su"
adb shell "-c '/data/local/tmp/su'"
adb shell "setenforce 0"
adb shell "cd /"
adb shell "mount -o rw,remount -t auto /system"
adb shell "cp /data/local/tmp/su /system/bin"
adb shell "mount -o ro,remount -t auto /system"
adb reboot
adb devices
adb enable-verity
adb reboot
Ok I try
jwoegerbauer said:
Try this
Click to expand...
Click to collapse
When I test adb "mkdir-p/data/local/tmp>2/dev/null" he say no such file or directory
stargam said:
When I test adb "mkdir-p/data/local/tmp>2/dev/null" he say no such file or directory
Click to expand...
Click to collapse
1. I think you forgot to type a simple "space" between Command: "mkdir -p" and Dirname: "data/local/tmp > 2 /dev/null"
2. And the last part "> 2 /dev/null" means redirect stdout (or error stream) and ignore it.
Conclusion, maybe just a typo? or err. mssge isn't what you think --> redirection made it dissappear.
Hopefully this works...
otherwise use this code:
adb devices
adb shell "mkdir -p /data/local/tmp" 2>nul >nul
adb shell "chmod 0755 /data/local/tmp"
adb push C:\su /data/local/tmp > nul
adb shell "chmod 0777 /data/local/tmp/su"
adb shell "/data/local/tmp/su -c 'cd / && mount -o rw,remount -t auto /system'"
adb shell "cp /data/local/tmp/su /system/bin"
adb shell "/data/local/tmp/su -c 'setprop ro.build.type user-debug'"
adb reboot
Click to expand...
Click to collapse
Cheerz!
webbex said:
1. I think you forgot to type a simple "space" between Command: "mkdir -p" and Dirname: "data/local/tmp > 2 /dev/null"
2. And the last part "> 2 /dev/null" means redirect stdout (or error stream) and ignore it.
Conclusion, maybe just a typo? or err. mssge isn't what you think --> redirection made it dissappear.
Hopefully this works...
otherwise use this code:
Cheerz!
Click to expand...
Click to collapse
Thanks it work ?