Related
Note - A user has complained that this hack has the possibility of crashing your market program if implementing. Although it has not happened to anyone that I am aware of, it is still something to consider when doing this! The user cites that when running DDMS from the android sdk a long list of errors is generated refering to this hack, I ran the same tool and didnt see any errors. This doesn't mean however that it isn't true, so, you should take this into consideration before you attempt this. Remember, you are responsible for your own device and what you do to it is your own doing and noone else's. Personally, I am still using this mod with no problems. Your results may vary!
So, as many of you are aware the market app continues to grow and eat up space..well, since having root it has been one of my priorities to figure out how to reduce the apps size and/or force the phone to save whatever data is causing the app to grow on the sdcard. Well, I have officially gotten it all figured out....
In order for you to do this you will need root access, look around on the forums to find out how to gain root access, also if you updated to the official rc30 then you are out of luck, sorry.
I am not responsible if you brick your phone by doing this! This shouldn't brick your phone, but if you do something stupid or wrong and it does brick your phone...then it is all your fault and noone elses! Be forewarned.
First off, if you would like to simply clear the cache that is causing the market app to grow then you need to obtain root on your phone. There are several different methods depending on how your phone is currently set up. For myself, I just have to open terminal emulator and type my secret word, for other you may need to type su, note that this applies to those using the modified rc30 update.
Next, simply type:
rm -r /data/data/com.android.vending/cache/*
That's it! go check the market application and you should be pleasantly surprised to find that it is now down into the kb range and not the mb range, mine was 11mb when I did this.
You will have to clear this cache every now and again as it builds up again unless, you do the following:
Obtain root and type the following commands:
Capitalization is important!
mount -o remount,rw /dev/block/mtdblock3 /
mkdir /sdcard/marketcache
mkdir /sdcard/marketcache/cache
mkdir /sdcard/marketcache/cache/webviewCache
cd /data/data/com.android.vending
rm -R cache
ln -s /sdcard/marketcache/cache cache
cd cache
ls
At this point make sure that you see webviewCache after you type ls
if you do, great, then you are all done and the market cache should now be stored onto you storage card.
if you don't then type the following:
mkdir /sdcard/marketcache/cache/webviewCache
ls
Now you should see the folder webviewCache and you should be done!
You can see this working by going to settings --> sd card & phone storage.
Make a mental note of your sdcards free space and your phone's free space.
now press the home key
open the android market
Browse a bunch of applications, the more the better.
now hold your home key down and go back to settings.
Look at your phone's free space and your sdcards free space.
The phone's free space should be the same and the sdcard's free space should be lower.
now press the home key
now obtain root on your phone once more.
type the following:
rm /sdcard/marketcache/cache/*
hold the home key down and go back to settings.
did your sdcard's free space go back up?
You can also use a file manager to look at the cache files on your sdcard now.
Btw, if you want to undo the changes simply follow this:
Obtain root
rm -r /sdcard/marketcache/cache/webviewCache
rm -r /sdcard/marketcache/cache
rm -r /sdcard/marketcache
mount -o remount,rw /dev/block/mtdblock3 /
rm -r /data/data/com.android.vending/cache/webviewCache
rm -r /data/data/com.android.vending/cache
mkdir /data/data/com.android.vending/cache
mkdir /data/data/com.android.vending/cache/webviewCache
That should do it.
If anyone has any questions let me know!
Stericson
great job bro
now how bout saving .apk files to sd card lol if possible ofcourse
Yep, I'm workin on that next....
yo i justed pmed you..if u can help me out it would be great
Great job! I think this deserves to be stickyed(my thought's out loud).
One question, have you played with the browser cache?
Thanks, the browser cache has already been done....Check this thread out:
http://forum.xda-developers.com/showthread.php?t=443336
Ok. Thanks for the link!
I keep getting a fail for mkdir saying it is a read only file system.
I guess I can't write to my sdcard from adb... anyone know a fix?
have you tryed to type su first(before "mount -o remount,rw /dev/block/mtdblock3 /")
yea tried that... stll doesnt work
I did it HAHA apparently you gotta mount it first.
yep you gotta mount it first, actually your remounting it with read and write permissions...
Here are my results:
original (A)
Cleared market cache (B)
Syslinked then browsed store (C)
Cleared market cache on sd (D)
A B C D
SD (free) 6509 MB 6509 MB 6495 MB 6509 MB
Phone (free) 29 MB 41 MB 41 MB 41 MB
Market (used) 12 MB 96 KB 96 KB 96 KB
thanks alot for this mod very much appreciated
Glad you, and others, found this helpful. I am happy to contribute something.
haitiankid4lyf said:
Here are my results:
original (A)
Cleared market cache (B)
Syslinked then browsed store (C)
Cleared market cache on sd (D)
A B C D
SD (free) 6509 MB 6509 MB 6495 MB 6509 MB
Phone (free) 29 MB 41 MB 41 MB 41 MB
Market (used) 12 MB 96 KB 96 KB 96 KB
thanks alot for this mod very much appreciated
Click to expand...
Click to collapse
I did one better... I did the browser cache also following the steps in this thread HEHE now I can install more apps HAHA
Sweet, I tried to symlink /data/app to the sdcard but...it didn't go very well...lol...still trying to figure it out.....
You won't be able to because that is where some of the important apps are that run on start up and such... you would need to shut those down which you really can't
but the only apps stored there are the ones downloaded from the market place....so why won't it work?
Stericson said:
So, as many of you are aware the market app continues to grow and eat up space..well, since having root it has been one of my priorities to figure out how to reduce the apps size and/or force the phone to save whatever data is causing the app to grow on the sdcard. Well, I have officially gotten it all figured out....
In order for you to do this you will need root access, look around on the forums to find out how to gain root access, also if you updated to the official rc30 then you are out of luck, sorry.
I am not responsible if you brick your phone by doing this! This shouldn't brick your phone, but if you do something stupid or wrong and it does brick your phone...then it is all your fault and noone elses! Be forewarned.
First off, if you would like to simply clear the cache that is causing the market app to grow then you need to obtain root on your phone. There are several different methods depending on how your phone is currently set up. For myself, I just have to open terminal emulator and type my secret word, for other you may need to type su, note that this applies to those using the modified rc30 update.
Next, simply type:
rm /data/data/com.android.vending/cache/*
That's it! go check the market application and you should be pleasantly surprised to find that it is now down into the kb range and not the mb range, mine was 11mb when I did this.
You will have to clear this cache every now and again as it builds up again unless, you do the following:
Obtain root and type the following commands:
Capitalization is important!
mount -o remount,rw /dev/block/mtdblock3 /
mkdir /sdcard/marketcache
mkdir /sdcard/marketcache/cache
mkdir /sdcard/marketcache/cache/webviewCache
cd /data/data/com.android.vending/cache
rm -R webviewCache
ln -s /sdcard/marketcache/cache/webviewCache webviewCache
cd ..
rm -R cache
ln -s /sdcard/marketcache/cache cache
cd cache
ls
At this point make sure that you see webviewCache after you type ls
if you do, great, then you are all done and the market cache should now be stored onto you storage card.
if you don't then type the following:
mkdir /sdcard/marketcache/cache/webviewCache
ls
Now you should see the folder webviewCache and you should be done!
You can see this working by going to settings --> sd card & phone storage.
Make a mental note of your sdcards free space and your phone's free space.
now press the home key
open the android market
Browse a bunch of applications, the more the better.
now hold your home key down and go back to settings.
Look at your phone's free space and your sdcards free space.
The phone's free space should be the same and the sdcard's free space should be lower.
now press the home key
now obtain root on your phone once more.
type the following:
rm /sdcard/marketcache/cache/*
hold the home key down and go back to settings.
did your sdcard's free space go back up?
You can also use a file manager to look at the cache files on your sdcard now.
If anyone has any questions let me know!
Stericson
Click to expand...
Click to collapse
I was running diagnostics on my phone and found this will crash your Market... you will not see any errors but if you use DDMS you will see the error log. The android OS protects apps from crashing and you can see the logs that show this method does not work... This is the reason using symbolic links for other things don't work also.
I ADVISE ALL OF YOU TO UNDO THE COMMANDS IMMEDIATELY!!!
Wow, thats pretty strong....I have been using it all day and no problems at all...I will check out what you did though.....
Can you post any of the error logs....
neoobs said:
I was running diagnostics on my phone and found this will crash your Market... you will not see any errors but if you use DDMS you will see the error log. The android OS protects apps from crashing and you can see the logs that show this method does not work... This is the reason using symbolic links for other things don't work also.
I ADVISE ALL OF YOU TO UNDO THE COMMANDS IMMEDIATELY!!!
Click to expand...
Click to collapse
How r we to undo the commands ?
Hi,
I've made a bunch of script usable with any JF mod
depend on you taste choose a size for you ext2 partition. and leave the rest in fat32
then download this http://www.badongo.com/file/13527235
and unzip it to your sdcard
open any terminal and type:
$su
#cd /sdcard/scripts
#sh 01_mount.sh
don't be afraid, your phone will reboot automatically at the end of the script
after the reboot,
open a terminal and type:
$su
#busybox df -h
You should something like this:
/dev/mmcblk0p2 1.2G 9.1M 1.1G 1% /system/sd
if it's ok
#cd /sdcard/scripts
It depend on you,
If it's the first time you use apps in sd type :
#sh 02_app2sd.sh
this will copy data/app and data/app-private to sd card, remove the original directories, create the good symlinks and reboot.
If you wanna recover your apps stored in your sd after an update or a theme install type :
#sh 02_restoreapp2sd.sh
this script will remove the original directories, create the symlinks and reboot.
the script 03_ move some cache apps to your sd.
you can edit it if you want but for now it move :
- the market's cache
- StreetView's cache
- Browser's cache
- Imeem's cache
- Tunewiki's cache
I hope it will help some of you.
The file located in rapid share has reached 10 times download limit, can you upload it to somewhere else?
Is there a way to do this on a adp1.1 phone that is not JF?
Or is there a way to get the terminal commands onto a adp1.1 without doing JF?
so we still have to push modified mountd and init across first...
or you could use lucidrem's JFMOD first and then these scripts?
unable to DL scripts...
more cache cripts here: http://androidcommunity.com/forums/f28/moving-caches-made-easy-12424/
Any update with this or is it dead?
Hi everybody, since nobody answered this post for almost 1 week i thought it was dead
well, this the new link
http://www.badongo.com/file/13527235
don't hesitate to tell me a good place to upload the files.
Bohemian
Is there a way to do this on a adp1.1 phone that is not JF?
Or is there a way to get the terminal commands onto a adp1.1 without doing JF?
Click to expand...
Click to collapse
No you need to have root to do this
MontAlbert
so we still have to push modified mountd and init across first...
or you could use lucidrem's JFMOD first and then these scripts?
unable to DL scripts...
more cache cripts here: http://androidcommunity.com/forums/f...de-easy-12424/
Click to expand...
Click to collapse
No, you don't need the lucidrem's JFMOD since the scripts.zip file contain the 2 modified files already.
Well i've just checked the Lucidrem's JFMOD and since the modified files point to /system/sd
you can use his mod.
then in my Scripts.zip you can skip the 01_mount.sh
to go straight to 02_app2sd.sh
As some of you might have seen or even used, I have created an application that allows executing of shell scripts from within Android and it will even allow you to create a direct shortcut on your homescreen to a script ( for example to start Debian or reboot your phone ).
I know a lot of developers ( I also didnt at first ) don't look in the "applications and games" section, but i thought it was the best place to post the actual application.
I will keep updating that post with the actual application process/updates, but ive created this thread to see if people ( I think most of the actual linux experienced people are in this section ) would like to share their linux knowledge to other peoples uploading useful .sh files ( for backing up stuff etc etc ), so that less experienced can just load them in to my application, without risking all typos.
So if you have a nice script that is useful please upload it so we can all benefit from it.
The actual application can be found here:
http://forum.xda-developers.com/showthread.php?t=486486
Please dont ask question or place suggestions about the application in this thread, but use the one Ive created for the actual development and keep this thread for scripts only.
Regards,
Rob
I was thinking about starting a thread just like this one-- for everyone to post up their scripts. Don't know why I didn't. Anyway, I asked the question awhile back how to create a script for remounting the file system as read/write, which led to my discovery of GScript. In any case, here's what I was told to use:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
Be advised that I have no idea if this actually works or not. Perhaps someone could test and post the results?
tubaking182 said:
that takes to long, i find it easier when i am using the comp to just click my terminal(which is almost always up and running) and type reboot_phone(i have a script on the computer that contains the comand adb shell reboot) and also another for rebooting into recovery and one more for bootloader
i guess i'm lazy but if i can find a way to automate anything i do in life i go ahead and do it. i have a script for nearly everything i do to my phone.
on a more on-topic note, i was hoping someone would post the command to reboot and apply an update.zip, i know it is in the JF autoupdater, but i just want to be able to hit a shortcut on my home screen to apply themes as well.
Click to expand...
Click to collapse
Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.
Edit:
--update_package=sdcard:update.zip
Should do it. I hope.
Here's a script I built to make a rom into the "lite" version needed by many of the themes. It's not much but it's my first one.
Code:
mount -o rw,remount -t yaffs2, /dev/block/mtdblock /system
rm -r /system/media/audio/ringtones
rm -r /system/media/audio/notifications
reboot
Gary13579 said:
Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.
Edit:
--update_package=sdcard:update.zip
Should do it. I hope.
Click to expand...
Click to collapse
You don't need the "su" at the beginning. Gscript has a checkbox to indicate if SU is needed and will add it on it's own. Putting it in causes the script to hang.
Anyway to make it close the script window when the script completes? Right now I have it doing an app backup and echoing DONE. But I'd like to automate the process if possible.
Exit doesn't seem to work.
Gary13579 said:
Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.
Edit:
--update_package=sdcard:update.zip
Should do it. I hope.
Click to expand...
Click to collapse
It does reboot into recovery mode but I get the error "Can't mount /sdcard/Update.zip Installation aborted."
I'm able to just apply the update by pressing Alt+S but would be nice if it was all automated.
wpbcubsfan said:
It does reboot into recovery mode but I get the error "Can't mount /sdcard/Update.zip Installation aborted."
I'm able to just apply the update by pressing Alt+S but would be nice if it was all automated.
Click to expand...
Click to collapse
Same result for me.
Got it!!!
ok!
used this as script to change theme
cp /sdcard/themes/aero/update.zip /sdcard/
echo "boot-recovery
--update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery
Needed to use caps for SDCARD!!!
found it poking around the recovery.c file
better still no need to copy over update.zip in root Just in case of emergency.
Code:
echo "boot-recovery
--update_package=SDCARD:themes/aero/update.zip" > /cache/recovery/command
reboot recovery
beagz said:
ok!
used this as script to change theme
cp /sdcard/themes/aero/update.zip /sdcard/
echo "boot-recovery
--update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery
Needed to use caps for SDCARD!!!
found it poking around the recovery.c file
better still no need to copy over update.zip in root Just in case of emergency.
Code:
echo "boot-recovery
--update_package=SDCARD:themes/aero/update.zip" > /cache/recovery/command
reboot recovery
Click to expand...
Click to collapse
Dude, you rock! Thanks!
Clear Caches
I use this script to clear almost all of the app caches
Code:
#Deletes all caches in one fell swoop :]
#Locations of the caches were taken from various sites, including xda and androidcommunity.com
#written by indiekid97
#Deletes browser cache
rm -R /data/data/com.android.browser/cache/webviewCache
#Deletes Maps cache
rm -R /data/data/com.google.android.apps.maps/files
#Deletes StreetView
rm -R /data/data/com.google.android.street/cache
#Deletes Market cache
rm -R /data/data/com.android.vending/cache
#Deletes Tunewiki cache
rm -R /data/data/com.tunewiki.lyricplayer.android/cache/webviewCache
#Deletes Myspace cache
rm -R /data/data/com.myspace.android/files
#Deletes GMail cache
rm -R /data/data/com.google.android.gm/cache/webviewCache
Copy from /system/app
I get get the phone to copy from data app and private however, when I try to copy apps from /system/app it does nothing.
Mod_edit
any ideas?
I also tried to cd in the script to navigate to the data and still it only runs the first two copy commands.
removed copyright procedureYou can not display procedures concerning the two app folders being transferred to Fat32 portion of card.
a1t said:
I get get the phone to copy from data app and private however, when I try to copy apps from /system/app it does nothing.
Mod_edit
any ideas?
I also tried to cd in the script to navigate to the data and still it only runs the first two copy commands.
Click to expand...
Click to collapse
Woops
Sorry dudes. If we can still talk about any possibilities, I'm down. if not, oh well. now on eggshells
looking for script to move a specific directory on /system to a location on my sdcard
if anyone is interested PM me.
What would the script be to disable USB mounting to the computer? It's a hassle for me to have to un-plug the USB cable when I want to unmount, it would be very beneficial to have a quick press of an icon on the Home screen to do this
*Edit: after tinkering around with it for a bit, I see that this cannot be done- I tried mounting the SD card to computer and then running a script, *any* script will not load because GScript requires /sdcard/gscript_tmp.sh to be accessable in order to run a script.
Mounting to computer and then running a script from GScript simply shows an error:
Code:
Error:
/sdcard/gscript_tmp.sh
SO, in order for it to work, GScript would probably have to be configured to search for the script elsewhere to load while the SD card is mounted.
Here is a small script to back up current system sounds to the SD card, probably most useful if you do this prior to using the Make Lite script:
Code:
cp -r /system/media/audio /sdcard/audio
If there are any errors please let me know.
Once they're backed up, you can merge the folder into /sdcard/media for proper use with Ringdroid.
I'm not sure whether to use cp -r or cp -a, so I will stick with -r for now and see if anyone has any other suggestion.
quick question....
where can i find out what the "flags" mean.
-a
-t
and so on.
Mikey1022 said:
quick question....
where can i find out what the "flags" mean.
-a
-t
and so on.
Click to expand...
Click to collapse
I found this link useful to your question, might want to scroll down a bit to see the most direct answer to what you were wondering:
http://www.freeos.com/articles/4414/
Hope that helps
a start
http://www.computerhope.com/unix/ucp.htm
a1t said:
http://www.computerhope.com/unix/ucp.htm
Click to expand...
Click to collapse
Proxin said:
I found this link useful to your question, might want to scroll down a bit to see the most direct answer to what you were wondering:
http://www.freeos.com/articles/4414/
Hope that helps
Click to expand...
Click to collapse
Thank you to both of you
Okay. If this is not where the MODs want this post, please move it.
[UPDATE] - Jump over to Post #12 for some of my recent ideas and changes for this application.
I have been using mods for the G1 and the myTouch 3G for a little while now. I have used Backup for Root, and I use Nandroid. I created just a little simple script to backup your device to your linux-based machine and restore from there too. The concept behind this is having your backup on your computer, not your sd-card. Please, feel free to contribute. (If this is not your cup of tea, please do not leave a comment). I am limited on time, and wanted to contribute a little to the community. All this script is a compilation of adb commands. Anyone could compile these commands, I just wanted it organized and in one place.
README
After using all of the backup tools for root, I have ran into random FCs and bugs. This script uses Android SDK's adb tool and was designed to be simple. This script goes through and backs up your applications, bookmarks, sms, alarm clocks, settings, launcher settings and dictionary. There are plans for this script to be interactive in the future. As for now, it is a very basic script that will backup your device then restore your device.
Notes. As for now this script requires sudo. On every other linux pc tested, sudo was required (maybe because user did not install adb correctly?). This will change in future versions.
= Details =
REQUIREMENTS
1. Android SDK Toolkit 1.5 or higher
2. Bash v4.0.33
3. Root access to your device
4. Root access to your pc
HOWTO
Backing-Up
1. Plug your device in
2. Open command-line (On PC)
3. Run ./abrtool -b
4. Done.
Restoring
1. Reboot from flash of rom (Enter credentials and let phone setup first)
2. Open command-line (on PC)
3. Run ./abrtool -r
4. Restart device
5. Done
Changelog
Version 0.1.5
- Merged into Android-Linux-Tools (alt)
- Changed zenity commands (shows restore progress)
- Option to restart device after restore
- Can install abrtool via command-line (./abrtool --install)
Version 0.1.4
- Added Icons
- Runs Fix Permissions after restoration of applications
Version 0.1.3
- Fixed Restore (Again) - Sets $BACKUPDIR as $PATH
Version 0.1.2
- Restore applications now uses adb install instead of push
Version 0.1.1
- Fixed Restore arugement (-r restores now)
Version 0.1
- Created initial script
- Creates backups for Apps, Sms, Bookmarks, Alarms, Settings, User Dictionary, and Launcher
- Restores device
Download
Project Page for Android-Linux-Tools (ALT) http://code.google.com/p/android-linux-tools
Project Page for abrtool http://code.google.com/p/abrtool
Download abrtool ConvertVideoToAndroid
Download InstallOnAndroid Nautilus Script
InstallOnAndroid
Disclaimer
I am not responsible for anything. Anything at all. I'm just not. Blame someone else if something goes horribly wrong.
[Reserved]
[Reserved for future post]
Nice script but bart.sh can accomplish a full backup of your Android environment for restoration at a later date. While it does it to the SD card initially, these "barts" can easily be copied to any computer. I can, however, see a use for this as it serves a slightly different purpose. Thanks.
I wasn't sure what response I would get to this post. I have had to flash, partition, format, wipe.. enough times that I just wanted to plugin into my computer, backup, wipe-flash then restore. Thanks!
nice. I don't use linux myself, but i see the point of having the backup else where (not an SD card attached to the phone itself).
will this, in theory be made to work on windows? Cause that will be awesome.
@str4vag It would be really simple to just use a .bat file for Windows. I don't have any plans on making a windows script anytime soon. Sorry. Same commands especially though.
This is exactly what I've been looking for, now I just need to mod it to sync apps/bookmarks/etc automatically whenever I plug in my phone, and to only sync the new items to keep it speedy, great work dev!
@ggolemg I can play around with some "real" features soon. I plan on having it archive your backups and allow you to select which backup (default is most recent) you would like to use. I am sure I can play around with your idea too. Thanks.
subscribing to the thread, idea is very interesting. i've been looking for a foolproof way to backup and restore bookmarks, sms messages, and different alarms, without all the issues of backup for root users. gonna check out the script tonight.
Update coming by the end of the week.
- Will only backup apps not already backed up.
- Possibly apply the Python interface I have developed.
- More goodies.
How about switchrom?
Android-Linux-Tools
Okay, so this week has been crazy for me. (Mind you I am a restaurant manager first and a developer (primary web) second). I think I am going to gear this project in a different direction. First off, I have created GTK2 Dialogs and a settings panel for this application. I would like to gear towards general linux tools on the pc side. So over the next two weeks you can expect,
- Graphical Interface for abrtool (Android-Backup-Restore)
- Configuration for each application.
- Nautilus Scripts for all applications.
- Right-Click to Encode Video (With GTK2 Dialog progress)
- Right-Click to Install APK (With GTK2 Dialog progress)
- Right-Click to Sign APK (With GTK2 Dialog progress)
- Right-Click to Copy Files to SD Card
- abrtool will backup to Ubuntu One Cloud (Simple adb pull ~/Ubuntu\ One/? or maybe play with the API?)
Ideas and Possibilities
- User.conf editor
- Select with applications to backup
- Switchrom features?
Any other thoughts or suggestions are welcome. I want to start simple, keep working on the abrtool and then make my way out to some other useful tools for us linux (Ubuntu) users. Let me know what you think and what would be helpful.
i had to make a bynch of edits so this dosent run as root, id recomend everyone do the same, only run root when you must. Also changed ,.adb to adb so i dont have to run it in my android sdk dir
@ahronzombi Can you post those changes?
I am a firm believer of only running root when needed, Like I mentioned before I don't really have a huge amount of time, and when I tested this on a friends notebook adb required root to atleast kill-server then you could perform shell/push/pull.
AFAIK, adb server only requires root if ou haven't set the proper udev rules for the device.
Exactly. If we want this script to run universally we cannot rely on all users to have added the udev rules. If they don't they have to run sudo. Maybe a quick check for the udev file then sudo if not?
boulderjams said:
Exactly. If we want this script to run universally we cannot rely on all users to have added the udev rules. If they don't they have to run sudo. Maybe a quick check for the udev file then sudo if not?
Click to expand...
Click to collapse
no i think it would be wise to have people understand there udev permissions rather than run root so its universal. that kind of thinking leads to very big security problems. with root in the script most of the simplest linux users could exploit anyone
I fully understand that. Do you mind posting your changes to the script?
this is the secure version of the script that dosent run as root
keep in mind i set my own adb and home directorys so you'll have to change those
Code:
#! /bin/bash
# abrtool version 0.1
# Last Updated Wednesday, November 18, 2009
# Android Backup Data and Restore Data Script
#TODO
# 1- See if config file exists
# 2- If not, create config file (for now, select directory to backup to)
# 3- See if arguments are specified
# 4- If not, return an error via dialog
# 5- If argument -b exists, run backup
# 6- If argument -r exsists, run restore
export PATH=${PATH}:/home/ahron/android/android-sdk-linux/tools:/home/ahron/android/abr
BACKUPDIR=/home/ahron/android/backups
USER=${username-`whoami`}
backupscript() {
export PATH=$PATH:$BACKUPDIR
adb kill-server
adb pull /system/sd/app $BACKUPDIR/apps
adb pull /system/app $BACKUPDIR/apps/device
echo "---------- Backed Applications"
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db $BACKUPDIR/msgs/mmssms.db
echo "---------- Backed Text Messages"
adb pull /data/data/com.android.browser/databases/browser.db $BACKUPDIR/bookmarks/browser.db
echo "---------- Backed Bookmarks"
adb pull /data/data/com.android.alarmclock/databases/alarms.db $BACKUPDIR/other/alarms.db
adb pull /data/data/com.google.android.providers.settings/databases/googlesettings.db $BACKUPDIR/other/googlesettings.db
adb pull /data/data/com.android.launcher/databases/launcher.db $BACKUPDIR/other/launcher.db
adb pull /data/data/com.android.providers.userdictionary/databases/user_dict.db $BACKUPDIR/other/user_dict.db
echo "---------- Backed Other Settings"
chown -R $USER $BACKUPDIR
zenity --info --text "Successfully Backed-up to $BACKUPDIR"
}
restorescript() {
export PATH=$PATH:$BACKUPDIR
adb kill-server
#sudo adb push $BACKUPDIR/apps /system/sd/app
echo "----------- Installing Applications"
cd $BACKUPDIR/apps
for searchfile in ./*.apk
do
echo "------------ Processing $searchfile"
sudo adb install "$searchfile"
done
echo "---------- Restored Applications"
adb shell su
adb shell fix_permissions
echo "---------- Fixed Application Permissions"
adb push $BACKUPDIR/msgs/mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db
echo "---------- Restored Messages"
adb push $BACKUPDIR/bookmarks/browser.db /data/data/com.android.browser/databases/browser.db
echo "---------- Restored Bookmarks"
echo "---------- (Please, make sure to restart your browser)"
adb push $BACKUPDIR/other/alarms.db /data/data/com.android.alarmclock/databases/alarms.db
adb push $BACKUPDIR/other/googlesettings.db /data/data/com.google.android.providers.settings/databases/googlesettings.db
adb push $BACKUPDIR/other/launcher.db adb pull /data/data/com.android.launcher/databases/launcher.db
adb push $BACKUPDIR/other/user_dict.db /data/data/com.android.providers.userdictionary/databases/user_dict.db
echo "---------- Restored Other Settings"
zenity --info --text "Successfully Restored Android device from $BACKUPDIR"
}
if [ "$#" -eq 0 ]
then
echo "Usage $0"
echo " -b Backup"
echo " -r Restore"
exit $E_OPTERR
fi
set -- `getopt "br:" "[email protected]"`
while [ ! -z "$1" ]
do
case "$1" in
-b) backupscript;;
-r) restorescript;;
esac
shift
done
To fully root your EVO, you must apply a couple of updates over the top of your current installation. They will completely erase your user data.
To backup your files before rooting:
- Plug in your phone to your computer
- Make sure you have adb installed.
- Download the unrEVOked userland root.
- Open a terminal and cd into your downloads folder (e.g. cd ~/Downloads)
- Type the following:
Code:
adb install unrevoked.apk
adb shell
su
-- Look at your phone screen. Superuser Permissions is asking you if terminal has
permission to become root. Click allow. --
mkdir /sdcard/backup/
busybox cp -R /data /sdcard/backup/data
This will place a full copy of your userdata partition on your sdcard. To restore files back to your userdata partition after the root, simply use busybox cp to move them back. If your new ROM didn't include busybox, download and install it:
Code:
adb push busybox /system/bin/busybox
adb shell
chmod 755 /system/bin/busybox
I haven't tried copying all my userdata from the sdcard back to the data partition. I've simply used this method to backup and restore files I really didn't want to lose (like my bike calculator logs). I don't know if you could circumvent the wipe by copying your whole data backup back to the data partition after rooting. If you'd like to try and find out, please leave your results in the comments.
I've noticed that the files I've restored from my sdcard back to /data/data have root permissions. In Android, each app gets its own user account that has permissions to its data. If you don't fix the permissions, your apps won't be able to save their data. I don't know how to lookup which app gets which user account, but once you figure it out, you can do this:
Code:
cd /data/data/com.myapp
chown app_83.app_83 ./*
where myapp and app_83 are replaced with the values you are changing. joeykrim has posted a link which may help you do this automatically (fix_permissions.sh) in his thread.
theillustratedlife said:
I've noticed that the files I've restored from my sdcard back to /data/data have root permissions. In Android, each app gets its own user account that has permissions to its data. If you don't fix the permissions, your apps won't be able to save their data.
Click to expand...
Click to collapse
i never got that far, w/o restoring the correct permissions the apps won't load and puts android into a continuous boot loop and it will keep trying to load the apps but the permissions wont match.
theillustratedlife said:
I don't know how to lookup which app gets which user account
Click to expand...
Click to collapse
i think the permissions are kept in /data/system/packages.xml ...
theillustratedlife said:
joeykrim has posted a link which may help you do this automatically (fix_permissions.sh) in his thread, but the link currently appears to be down.
Click to expand...
Click to collapse
switched hosting providers, this link got lost in the shuffle. its http://www.joeyconway.me/evo/apps/fix_permissions.sh . updated my post. thanks!
Interesting. I've only used this trick to restore data selectively. I haven't tried moving the whole backup back into my /data partition.
Thanks for the heads up.