Build Your Own alt+w Wipe...(edit: if you don't use apps2sd...) - G1 Android Development

First Note: These apps will become uninstallable! (much like any other stock rom apk) and must be deleted using the console, somehow.. anybody care to shed some light on how?
Hopefully someone can add more to this or use this info to build a much more thorough how-to, but for now here's what I've got...
Instead of building your own update.zip you can modify your alt+w wipe data to reinstall the downloaded/backed-up apks of your choice. This can also be used to install 3rd party apks without having access to any other installer, for instance if you wipe then find yourself without any access to the internet/market or a computer.
To do this you must first have the apps on the sd. I used astro to backup apps which puts the apks in /sdcard/backups/apps
I'm doing this on IonR2, your system apps may be elsewhere, mine are located in /system/app, you'll need to know where they are for this to work.
Power off your phone and do this (enter the bold stuff only, replace my directories with yours):
home+power (enter recovery)
alt+x (to go to console)
hit enter (cause the prompt says so..)
/ # mount sdcard
/ # mount system
/ # cd sdcard/backups/apps (or cd to where ever your backed up apks are)
/sdcard/backups/apps # ls *appname* (this may be useful for finding the exact *.apk name)
/sdcard/backups/apps # install -cp org.appName.com.apk /system/app (remember to capitalize where necessary)
at this point it should hang for a second then return to the "/sdcard/backups/apps #" prompt, if so the apk has successfully been added.
/sdcard/backups/apps # reboot (or install more apks if you like)
home+power then alt+w to test if you so desire. now your backed up apk should reinstall itself if you ever have to do an alt+w wipe again..(weather the apk is on the sd card or not)
I know, not very thorough but wth, I figured someone might find this as useful as I did(or be able to expand on it a bit, data, app settings etc). Also cool if you happen to have no net connection, no pc access and a wiped phone with no real useful/fun apps...

u only have to do this once, and it'll flash the new roms WITH these apps installed? how do we 'clear' these apps if we don't want to have them installed when we wipe?

Is it possible to install all the apps in your backup directory at once, with some sort of batch command?

These apps will become uninstallable! (much like any other stock rom apk) and must be deleted using the console, somehow.. anybody care to shed some light on how?
@ Lieu10ant, yeah, you only have to do once/updated rom, this modifies the base install. the newely added apks will be installed every time you alt+w (wipe). If you apply an update.zip this process will need to be redone(I'm pretty sure, haven't tried).
@ lukekirstein, I'm sure there's a way but I'm not sure how. Really hoping someone more knowledgable jumps in here with a bit more info :/
I've added a file manager(with backed up apps installer) and wifi tether because I always need/use em and never really planned on uninstalling em..

Im pretty sure you would have to use "rm" and individually remove all apps you dont want.

instead of backing up your apps, just run apps to sd and never reinstall any apps again

Breakthecycle2 said:
Im pretty sure you would have to use "rm" and individually remove all apps you dont want.
Click to expand...
Click to collapse
you would mount the system again from the recovery console and 'rm' each app you don't want. You would want to be careful not to batch delete stuff.

sonikamd said:
These apps will become uninstallable! (much like any other stock rom apk) and must be deleted using the console, somehow.. anybody care to shed some light on how?
@ lukekirstein, I'm sure there's a way but I'm not sure how. Really hoping someone more knowledgable jumps in here with a bit more info :/
Click to expand...
Click to collapse
Wouldn't it be a nice thing to make them uninstallable? That would, in theory, make them a lot more stable like the stock apps and can only be updated, not modified. You can probably delete them through console in recovery or even through ADB if you wanted to. It'd definitely be impossible to do it through some basic installer or the package uninstaller while the phone is running normally. The same process as a stock app.
I know you can't do it while the phone is running (bummer :/) but I was hoping it's possible when the phone is off.

@ Breakthecycle2, cool, I figured rm through console after mounting but haven't tried so wasn't 100% on that one.
@ Sirus20x6, I prefer this method to apps2sd, mainly because everything's stored in the phone's internal memory. Although I know most folks now seem to be using an apps2sd of some sort.
@ lukekirstein, yeah. That's why I do it this way, but some may want them uninstallable so I figured I better make a point to inform those folks

Wouldn't this decrease your internal memory since these apps are being saved to the phone so you can later wipe?

jusplainmike, I would assume so. Something to keep in mind.

Would a nand be better?

sonikamd said:
I'm doing this on IonR2, your system apps may be elsewhere, mine are located in /system/app, you'll need to know where they are for this to work.
Click to expand...
Click to collapse
(10c)

perhaps, depends on what you want I suppose. I wipe clean every so often just to get a fresh start, speed things back up etc. Sometimes while installing themes I wipe multiple times and also just want a clean slate.
This is definitely not the way to go for a complete backup-restore. Just seems a good way to reinstall a few missing by stock apps after a wipe.

lol soulife i know, i know

I believe apps2sd is the best bet for keeping apps after a wipe or fresh install.

retort
sonikamd said:
lol soulife i know, i know
Click to expand...
Click to collapse
The only reason is because you push a market app to internal memory it read only. If there's an update you have to open terminal or adb and rm and push the update back. Plus if you flash a new update it will wipe them out. With a2sd however you can update them no hastle, and even if you flash a new build, with a2sd the reinstall themself. Much more convient as long as you smart with your partitioning.

I think you guys may be doing this the hard way. If you are wiping and moving to a compatible ROM, just leave the sd card as it is and the new ROM should be able to find and install the apps as long as it has apps2sd built in.
If you are moving to an incompatible ROM you will have to remove old sd app directory first.
rm -r /system/sd/app
then you should be able to just copy over your entire apk backup directory to your sdcard as follows.
cp- a /sdcard/yourdirectoryname /system/sd/app
and if you are installing a ROM that has app2sd built in, it should find all the apps and install them.
If the ROM you use does not have apps to sd, then you will be able to use Lucid script to move apps from phone to sd card app directory (with already copied apps) and link directory

Tru, I just don't use apps2sd. My sd is constantly getting mangled for one reason or another..

uh, by doing this you're filling up your /system folder which actually needs memory to improve. and you can uninstall them by
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
rm/system/app/nameof.apk
on another note wouldnt wiping while having info in the system ; wipe?
anyways

Related

i cant uninstall a corrupt app

ughh this is what happens when i get tooo adventurous
okay, exactly what happened,
i tried to edit the icons of some after market applications and put them onto a theme update for myself,
i got the apps off of my phone using appmanager,
one of which was hello im!
well that hello im app install unsuccessfully, only shows up in atrackdog and the applications list under settings, and refuses to be uninstalled, i even tried to download the real hello im! again over it but because it refuses to uninstall i get an error!
what have i done?
cd /data/app (or /system/sd/app if you've got apps on sdcard)
rm com.corruptapp.apk (probably com.helloim.apk)
no such file or directory
according to astro it reads com.multiplefacets.aol but that didnt work either
does anyonee know?
i really really dont want to start over and reset my phone because of this
backup your apps, and wipe your phone, then just install the one's that work, sincce you tried the easy solutions that seems to be the most likely to work now
or you can just use fschk in linux os....
sadly im runnin vista
okay i tried this
cd /system/app
rm HelloIM!.apk
and it actually found it, because that is where it is
but refused to delete it saying it is a read-only file system
YESSS I WINNNN!
MWAHAHAHAHA
i used the same technique that is used to manually delete the stock sounds and by doing so i was able to remount the system as read/write and delete that sucker!
http://forum.xda-developers.com/showthread.php?t=474939&highlight=delete+system+files&page=2
Awesome. Glad you got it without wiping.

For MAC users. Multiple-App installing script

So I was tired of having to install my apps one by one after a wipe or x problem. So with a lot of help from an apple scripting forum, I made this droplet app.
To use it you must have at least adb installed. Connect your phone to your mac via usb. Put all the apps you want installed into a folder. I would avoid naming the folder "untitled folder". I don't know why, I just had a problem when I tried it once. So after all of the apps are in the folder, drag the folder onto this application. All you need to do is wait, the applications will install and you are done.
I am keeping this application in my /android/tools/ folder, just so that I don't lose it.
Feel free to edit the script in any way. Enjoy.
http://www.mediafire.com/?sharekey=c3b7d500bfc2706d1f8e0fff488e27e0e04e75f6e8ebb871
yaaaayyy! great work my friend
great job on this!
is this the same as using adb?
adb push *.apk /data/app/
I would like to have a way to fresh install all the apk after wipe
but i think apk installed via adb would not be automatically tracked for new version by market, right?
kiddyfurby said:
is this the same as using adb?
adb push *.apk /data/app/
I would like to have a way to fresh install all the apk after wipe
but i think apk installed via adb would not be automatically tracked for new version by market, right?
Click to expand...
Click to collapse
this is using the adb install command not push. But I don't know the difference between the two. I have such a small understanding of this. I don't believe that the applications are tracked by the market with this, but I would love to know how it could be done.
Does anyone know if there is a way to install them and have them be tracked?
Solid contribution. Really like what you've done. I don't need it, but I'm sure a lot of people without a full linux distro will enjoy it.
Anything for the mac side of things has got to be good. Mucho props for this.
So I still know nothing about installing the apps so they are recognized by the market. However i did remember that aTrackDog does just that. So as long as most of the programs you install fresh on your device are relatively new, then aTrackDog should be able to help.
I do realize that updating an app(uninstall and reinstalling) takes just as long as the initial install. but at least it would be fewer at a time right?
i noticed that if you restart the phone mid way through installation,
the download would resume after reboot.
so I was thinking if I could inject information into the vending app
that way I can hopefully trick market into downloading the latest app for me
and update tracking would work
I messed around with assets.db->assets10 a bit
I did found the package name and status there, tried adding a new record but the market app is not picking it up
my guess: we might need some corresponding data on google mothership for that to work
i do not like aTrackDog, i prefer native market tracking instead
maybe i can try backing up the whole data folder for the market app next time i wipe
where would the market app save the data once you download it? would we be able to replicate that process? like sending the data from each app we install to the market app? because that would be unbelievable!

Creating my own recovery.img?

So unless I have missunderstood something, the recovery.img is what state the phone returns to when you do a factory reset. I would very much like to change this state to have a few apps installed and pre-configured.
The best solution would be to create a recovery-image from say nandroid-backup. Is this possible? Or are there any awesome guides out there that teaches how to create your own recovery-images?
Cheers,
edit: I found alot of good information in these threads, but I really cant find information on how to customize my recovery-image to have certain apps installed, and such. Im guessing there is no automated way to transfor a nandroid-backup to a recovery image
http://forum.xda-developers.com/showthread.php?t=443994
http://forum.xda-developers.com/showthread.php?t=575144
recovery image is the barebones boot up and options that allow you to wipe, nandroid, and such. when powering up and pressing home at the same time, this is the recovery image. what you are talking about is either creating your own update, with preinstalled apps, or creating a clean nandroid backup with some apps installed. hope this clears up a bit.
byt3b0mb said:
recovery image is the barebones boot up and options that allow you to wipe, nandroid, and such. when powering up and pressing home at the same time, this is the recovery image. what you are talking about is either creating your own update, with preinstalled apps, or creating a clean nandroid backup with some apps installed. hope this clears up a bit.
Click to expand...
Click to collapse
I see, thanks for the info. So maybe I should not change the recovery-image. But I want to change the state the phone returns to when I do a factory reset. I think atleast the recovery-image is loaded during factory reset, because I have managed to make factory reset not work by making a faulty recovery image that hangs the phone, lol.
Maybe this is what I should do: An update.zip that inclodes a ROM that has pre-installed apps. Is this what the phone returns to at a factory reset?
sandis84 said:
Maybe this is what I should do: An update.zip that inclodes a ROM that has pre-installed apps. Is this what the phone returns to at a factory reset?
Click to expand...
Click to collapse
Correct
ronni.rasmussen said:
Correct
Click to expand...
Click to collapse
I have tried creating an update.zip, but I have ran into some problems as specified in this thread:
http://forum.xda-developers.com/showthread.php?p=5101633#post5101633
However, I am still unsure on how this update.zip would work. It feels as if I should edit the data.img-file, since it contains the information in the data-folder (i.e. the apps and their state). But I have found no editor or guide to do this. However, this might only change the state of the phone directly after installing the update-zip? If I install an update.zip with modified data.img, is this really what the device will return to after a factory reset?
I.e, exactly from where does the phone load the state it returns to after a factory reset?
Cheers,
are you wanting to have all gmail and other things with passwords already done or simply install barebones rom with your little bits you want
if its the latter option thats easy
make an update zip with your apks wifi apn settings inside and flash stright after installing rom before a reboot
or open up your desired rom and drop the files in the correct folders re-sign and thats it
sitimber said:
are you wanting to have all gmail and other things with passwords already done or simply install barebones rom with your little bits you want
if its the latter option thats easy
make an update zip with your apks wifi apn settings inside and flash stright after installing rom before a reboot
Click to expand...
Click to collapse
Im not sure I understand, but here is a clarification of what I want: What I want to do is specifically to change the "factory reset state". I am trying to do this to make a personalized very noob-friendly ROM, where they can just make a factory reset and still keep their essential apps and settings. It is meant for people that for example arent technical enought to make a restore from nandroid or such stuff.
edit: To create an update.zip with certain apps and settings, is there a complete guide for doing that? I have found many guides that covers parts of it, but I always run into problems.
edit2: Nvm, I have nog managed to create an update.zip. So I just add some apk-files to the data/app-folder in the boot-img in the update? Well, Im going to give it a try... I'll report back in a while =)
Well, I have managed to create and install an update.zip, but the result is not showing up! I create my update, place it on the sdcard, start in recovery mode and run the update. Then i restart.
When I restart first i see the "phone out of box"-image for about half a second, then splashscreen. Then "phone out of box"-image for half a second again, and then it returns to the splash screen and boots normally.
When it has booted I check if my changes has applied. What i have done is I have tried to create several directories in the file system by adding three lines in the init.rc:
Code:
mkdir /sdcard 0000 system system
mkdir /system
[b]mkdir /test1[/b]
mkdir /data 0771 system system
mkdir /cache 0770 system cache
[b]mkdir /test2 0770 system cache[/b]
mkdir /sqlite_stmt_journals 01777 root root
[b]mkdir /test3 01777 root root[/b]
mount tmpfs tmpfs /sqlite_stmt_journals size=4m
But none of these directories has been created. Even worse, the lines I added are gone from init.rc! It seems as if the update was never applied. What could be wrong? Any help would be VERY appriciated, since I feel very very stuck at the moment.

[APP][ROOT][3.0+] Backup2Tar v0.1 Flashable App+Data Backup using Tar.

Backup2Tar is a Free backup tool that I created to help restore my apps after flashing a new rom.
How it works :
Select which apps to backup from the UI
The app generates a tar file on your sdcard (update.tar.gz) with the package files and data.
Finally, the app will generate restore_tar.zip which contains busybox and a small shell script to find update.tar.gz and extract it.
As of right now it's a very simple app, there are no options at all and I made it for personal use and to (re-)learn Java.
FAQ :
Why tar?
because it's the standard archive format on Linux, preserves permissions and user information.
But all the cool kids use zip files.
Yes, sure you can hack a nice updater-script to fix permissions on all files, but it's bound to screw up permissions some way or the other, specially with apps that have executable files in their /data/data/.
Your icons suck
Feel free to create new icons for the app and I will gladly use them.
Is there anyway to help?
Provide me with ideas, ways to improve it, better artwork and feel free to donate!
TODO :
Toggle saving apps' data and/or cache.
Store other important settings (wifi, gps, etc).
Clean up the source code and publish it.
Tested Devices :
N7000 (running 4.1.2 / Phillz Kernel).
Rooted 3.0.0, 4.0.3, 4.2.2 Android emulators (tested using update-binary, not from recovery).
All comments / suggestions are welcome.
Changelog :
v0.1
Initial alpha release.
Sounds useful, downloading now. Thanks!
Sent from my SGH-I897 using XDA
Will this backup my paid apps or only non "protected" apps?
famewolf said:
Will this backup my paid apps or only non "protected" apps?
Click to expand...
Click to collapse
I'm not sure, I don't have any protected apps at the moment to try with.
If you can test and report back it would be great.
The app copies /data/app/xxx.apk and /data/data/xxx, so if the protected files aren't in /data/data they won't be copied.
life.eq.null said:
I'm not sure, I don't have any protected apps at the moment to try with.
If you can test and report back it would be great.
The app copies /data/app/xxx.apk and /data/data/xxx, so if the protected files aren't in /data/data they won't be copied.
Click to expand...
Click to collapse
I'll see if I can get some time to install and try it.
Have you considered adding /system/app and it's associated data to the list? An app might be included in one rom and not in another so I'd still want the ability to back it up even if it has to back it up to /data
Also I didn't see it in the screenshots but if not there a single checkbox to backup ALL apps in list would be highly useful rather than having to click all of them.
You can backup system apps as well.
I found a bug in restoring, some apps won't restore right without "reinstalling" using the package manager, gonna try to figure out how to call the package manager from recovery.
Workaround to fix the apps that aren't working after restoring is to use adb shell.
PHP:
$ adb shell
$ su
# tar tzf /sdcard/update.tar.gz | grep data/app/ | while read APK; do pm install -r "/$APK"; done
This basicly will use the package manager to "properly" install all the apk.
I will release a fixed version later today.
I will add check-all option as well, I'm still getting the hang of action bars and such.
does this script preserve "move to sd" location? i mean, i used a lot "move to sd" standard android function, to move many big apps to sdcard/.android_secure folder... of course, none of the those that use widgets...
i found that restoring with titanium backup does not preserve this: if i batch restore my apps, it fills up my internal memory (samsung note n7000), and i've to move a bunch of them to sd before redoing restore of the remaining ones... very boring...
is there a way to restore apps EXACTLY in the same location where they were when backupped? thanks
Is it possible to backup the whole ext partition as well? As Im using Link2Sd and to restore it quite tedious. My apps + games are out of the internal space.. So, I extend using ext partition.
Can we flash the backup to stock unrooted rom ,from the stock recovery??
Sent from my GT-I9070 using xda premium
no answers in days from the developer to a fresh project... then no development at all? hope not...
mrshark said:
no answers in days from the developer to a fresh project... then no development at all? hope not...
Click to expand...
Click to collapse
You posted your original question late on the 28th and this most recent complaint early on the 30th at least by my timezone....perhaps you have an unreasonable expectation as to how soon he needs to respond to you.
famewolf said:
You posted your original question late on the 28th and this most recent complaint early on the 30th at least by my timezone....perhaps you have an unreasonable expectation as to how soon he needs to respond to you.
Click to expand...
Click to collapse
3 weeks is enough?

Galaxy S7 SM-G930F (6.0.1) - System Partition Size

Hi All
I am hoping someone can help... I have the Galaxy S7 (SM-G930F / 6.0.1 / UK / EE) and have come up with an issue.
I use Cerberus Apps in case my phone is lost - you are able to install this into the system to avoid someone wiping the phone and removing the software. To do this the phone must be rooted and then I usually use Link2SD to transfer the app to make it a system app. This has always worked on my old phones - but alas not this time.
The problem is that the system partition (4Gb) is full!! I have deleted all the language packs to try and clear some space - but it is still full! Strangely enough I also uninstalled an "Amazon" app which was listed as being a system app and quite large (from memory I think it was just under 100Mb)... but when I removed it and rebooted the system partition free space remained unchanged! It's possible that Amazon was a user app and I mis-read it... but anyway - I thought that the only way to clear some space was to resize the system partition - so I installed TWRP (3.0.2), have done a complete backup (system/efs/etc) apart from \data as this showed 0Mb and "failed to mount" when I tried to back it up originally.
So, my question is - can anyone help me to free some space from the system partition to allow Cerberus App to be stored there? I did think about uninstalling the VR Gear files as I dont have a VR device and assumed I could re-load these from Google Play if needed - but I do have the Galaxy Gear watch - so decided not to remove these files in case it screwed this up. Not sure which Google Apps I can remove and re-install if needed... so if anyone knows this, then that would be a help too
I thought you could resize the partition in TWRP but cant find any clear details on how to do this, so thought I'd ask here before I screw the phone up :silly:
Any ideas/help greatly received.
TWRP doesn't support encryption so that's likely why /data won't mount. Resizing partitions is typically done via Odin with PIT files, but it's very dangerous, so I wouldn't recommend it.
Luxembourg ROMs have around 130mb free system space, so there must be a ton of carrier bloat in yours. This doesn't sound right though, it's required that there is some space for expansion. Could you run the following command in a root terminal and post the results please?
df -k | grep system
CurtisMJ said:
df -k | grep system
Click to expand...
Click to collapse
Thanks Curtis - I left my phone at home today, so will try this tonight and post results. After deleting all the unwanted language files I have about 40Mb space free, but this still doesnt seem to be enough as when I run Link2SD and reboot the phone, Cerberus has vanished and has to be re-installed... although when it re-installs it shows it as an "update" which would indicate that it is installed already - just 'lost' ???
Will update tonight when I get a moment.
Thanks
That's interesting actually. It seems to be indicative of permission issues. The app was successfully moved to the system, but the permissions on its files were wrong and the system refuses to load it(Link2SD's fault, essentially) . It's still acknowledged by the app manager though, which is why it can be "updated". Can you try move it with something apart from Link2SD? I recommend titanium backup.
CurtisMJ said:
Can you try move it with something apart from Link2SD? I recommend titanium backup.
Click to expand...
Click to collapse
Thanks Curtis - I have Titanium Backup (free version) installed already so can give it a go - I have only used it for backups (a long while ago) and have never used it to relocate an app... is it fairly self explanatory how to do it?
Will look tonight when I get in
Thanks
Just tried with titanium myself and it fails in a similar manner. Seems Marshmallow is a little fiddly and Link2SD puts out a generic message when it has issues. Titanium just freezes. You'll have to do it manually
First you'll need to clear the system of failed attempts. Look in the /system/app and /system/priv-app with a root Explorer for Cerberus apks or folders. Next, look in the /data/app folder and find the Cerberus folder. Take note of this path.
Next, fire up a root terminal and enter the following commands. In my case I was moving Greenify.
mount -o remount,rw /system
cp - a /data/app/com.oasisfeng.greenify-1 /system/app/Greenify
Replace the data folder with your noted path. The system path can be anything.
Then reboot and the app should be system.
Hi Curtis
Thanks for spending so much time on this.
OK, I skipped straight to the manual relocation method that you said. Whilst the app is Cerberus the APK etc is called System Framework as I have installed the 'hidden' version rather than the one which shows as Cerberus on the phone. However using OI File Manager, when I look in /system/app and /system/priv-app folders there is nothing called Cerberus or System Framework... so I am assuming that there are no orphaned APKs or other files.
But, this is where the strange thing starts, when I look in the /data/app folder, it is empty... so I am guessing I am looking in the wrong place as there are loads of apps! I am looking from home then selecting data, etc... any thoughts?
Oh, I have checked that hidden files are shown too!
Thanks again
i used to install the same app on my S7
please follow this guide & let me know the result.
1- uninstall Cerberus App, Link2SD, TTb, etc. and reboot
2- install SystemCleanup.
3- from the app SystemCleanup swip to tab apps and remove some bloatware like Google books, music, games, google TTS.
4- Reboot & install Cerberus App, do not run it.
5- from the app SystemCleanup go to apps tab and move Cerberus App to system/app & reboot again.
6- That's all.
Click to expand...
Click to collapse
Hi Abuzar
Thanks for the help... I tried using System Cleanup and initially it didn't work... it didn't show System Framework after cleaning up which made me think it was uninstalled properly. But when I tried to re-install it I got a message asking if I wanted to update the the built in application... so I said yes and re-checked in System Cleanup and it was visible, so I tried uninstalling it and after a couple of attempts it succeeded.
Then I re-installed and it installed it as a new app and it was visible in System Cleanup as installed in /data. So, I moved it to /system and configured it. It now lists in System Cleanup as being installed @auto system+data... so I am assuming it has installed properly... but not 100% sure as it lists some of it in data - so not sure if after a reset it will wipe the user profile from Cerberus or not.
I took a backup in TWRP and thought I would do a factory reset and test it... but on the S7 using factory reset in O/S it asks for my samsung password etc so looks like it may delete my Samsung/Google account's so didn't proceed as I didn't want to delete any online info. So... I tried factory wipe in TWRP but it just said failed "could not mount /data and unable to find crypto footer" and a few more "failed to mount /data" errors... so I gave up and will have to assume its installed properly as a system app
Thanks for all your help.
Just as a final note, the system+data combo sounds normal. Under regular conditions, the system partition is read only, so in order to install any updates to system apps, Android actually installs them as data apps, but cross-references them to system apps and gives them the relevant permissions. You can remove the data part by selecting "Uninstall Updates" in the app info page.

Categories

Resources