Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[TUTORIAL] Create your own UPDATE.ZIP

OP mackief

20th April 2012, 10:27 PM   |  #1  
mackief's Avatar
OP Senior Member
Flag Rome
Thanks Meter: 1,000
 
1,374 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Hi all! This is a guide from PIRATEPARTY about the creation of a simple UPDATE.ZIP to flash on your Android phone, in recovery mode.

I've created a repository on GITHUB where you can download the "update.zip" that we'll use and modify.

So, this is the repository: update.zip--for-Android-Devices-
You can download it as ZIP archive and rename it as update.zip .

So, we have now the most important file, that we're going to modify:
All the apps that you want to insert in the archive and install on the phone, must have the .apk estension and you have to put them in /data/app . Then, if you want also the app data files, you have to take these files from your phone, going with a rooted file manager (i suggest Root_Explorer) to /data/data , copying the app folder and pasting it in /data/data of the UPDATE.ZIP.
So we have all the apps and datas that we want. Now, we have to write the script.
Let's go to META-INF/com/google/android/ and open 'updater-script' with a simple text editor.
The only lines that you have to modify are:
Code:
set_perm(1000, 1000, 0644, "/data/app/[PACKAGE].apk");
set_perm_recursive(1000, 1000, 0777, 0777, "/data/data/PACKAGE_DATA_FOLDER");
delete("/data/dalvik-cache/data@app@[PACKAGE].apk@classes.dex");
For each app you have to write these lines. This is an example if you want to put ROOT_EXPLORER.APK in the UPDATE.ZIP:

Code:
set_perm(1000, 1000, 0644, "/data/app/ROOT_EXPLORER.APK");
set_perm_recursive(1000, 1000, 0777, 0777, "/data/data/ROOT_EXPLORER_DATA_FOLDER");
delete("/data/dalvik-cache/data@app@ROOT EXPLORER@classes.dex");

That' all. But if you want to delete some apps from your phone, you have to write between
Code:
ui_print("| 80%  Installing Applications |");
and
Code:
package_extract_dir("data", "/data");
this line:
Code:
delete("/APK_DIR/APP.APK");
IT'S IMPORTANT TO LEAVE AN EMPTY LINE AT THE END OF THE SCRIPT, OTHERWISE THE ZIP WON'T WORK!

You can easily find the name of the app going with Root Explorer to /system/app and searching the same app.

If you also want to add your modified Apps, you've to sign them with a simple app: Auto-Sign, putting them in /auto-sign/update/app and renaming it to Launcher.apk .
You can download AUTO-SIGN from the attachements!

With it you can sign your apks or your zip. So, finally, when you'll finish your zip, you'll have to put it in Auto-Sign folder ("/auto-sign").
Then, open Auto-Sign, choose your zip or apk, and click AUTO-SIGN. It will create a new apk or zip, name as SIGNED-apk/zip.

Now, you only have to put the update.zip on your sd-card and flash it! Have fun guys!
Attached Files
File Type: zip Auto-Sign.zip - [Click for QR Code] (80.3 KB, 15501 views)
Last edited by mackief; 16th October 2012 at 01:31 PM.
The Following 56 Users Say Thank You to mackief For This Useful Post: [ View ]
30th April 2012, 02:56 PM   |  #2  
Senior Member
Flag Paris
Thanks Meter: 278
 
759 posts
Join Date:Joined: Mar 2007
More
mackief,

Thanks for your tutorial. I wrote a removal script for GB that deletes everything i don't use in my ROM. I recently moved to ICS and that very script is still working but, each time, during restart, I lose root rights.

Any idea where it could come from?
30th April 2012, 11:40 PM   |  #3  
mackief's Avatar
OP Senior Member
Flag Rome
Thanks Meter: 1,000
 
1,374 posts
Join Date:Joined: Mar 2012
Donate to Me
More
What rom are u using?? What device??
I think that the problem is about the rom, cause you said that u didnt have problem in previous rom and you used the same script...
So, to find the problem, i have to know the rom, the device, and the script.
Can you post the script here?
The Following User Says Thank You to mackief For This Useful Post: [ View ]
23rd May 2012, 10:16 AM   |  #4  
Senior Member
Flag Paris
Thanks Meter: 278
 
759 posts
Join Date:Joined: Mar 2007
More
mackief,

Sorry for having been so long to answer, I was not monitoring the thread

I use nightly CM9 roms for my Note (N7000). You'll find attached my latest script that still bothers me.

If you can have a look at it, it would be nice.
Attached Files
File Type: zip updater-script.zip - [Click for QR Code] (1.9 KB, 1961 views)
Last edited by The_Steph; 23rd May 2012 at 10:23 AM.
The Following User Says Thank You to The_Steph For This Useful Post: [ View ]
23rd May 2012, 12:01 PM   |  #5  
vua777's Avatar
Senior Member
Thanks Meter: 91
 
559 posts
Join Date:Joined: Jun 2005
good lession for tweaking my one x
23rd May 2012, 01:42 PM   |  #6  
mackief's Avatar
OP Senior Member
Flag Rome
Thanks Meter: 1,000
 
1,374 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Quote:
Originally Posted by vua777

good lession for tweaking my one x

I'm glad do help you!

Quote:
Originally Posted by The_Steph

mackief,

Sorry for having been so long to answer, I was not monitoring the thread

I use nightly CM9 roms for my Note (N7000). You'll find attached my latest script that still bothers me.

If you can have a look at it, it would be nice.

I read your script, but i think that the only problem is about the root app: Superuser and his components. So, check out if some elements that you want to delete are associated to Superuser, and dont delete superuser.apk .

However, usually, in CM9 there are some apps that you CANT and HAVE NOT to delete. I suggest to you to read this file: REMOVABLE APPS

So, Superuser gives you root rights, so dont delete it.
Dont delete the list of apps that is on the link above.
The last suggestion is that you have to check if you're deleting something else that can create bugs with superuser and his working.
Write me if you want to know something else or also if these solutions arent useful: i'll help you! Bye!
The Following User Says Thank You to mackief For This Useful Post: [ View ]
26th May 2012, 04:25 AM   |  #7  
Волк's Avatar
Senior Member
San Francisco
Thanks Meter: 536
 
1,076 posts
Join Date:Joined: Jan 2012
Donate to Me
More
Interesting guide. I am curious though, you have it setting permissions but have you tried it without doing so? I ask because I made a script for CWM which copies my apk's to data/app/ and I don't set permissions and have no issues. In theory you shouldn't need to, the apk should retain the proper permissions even when copied. As well, why not set the permissions for the entire contents of the folder, ie, set the permission recursively like you do for data/data and have it run at the end of the script once everything is copied?

Lastly, one thing to note with this method of installing apps is that your first boot will take awhile, the ROM has to create the Dalvik for all the apps you just flashed, I hadn't considered that when i first ran my script and thought something was wrong.
26th May 2012, 01:08 PM   |  #8  
mackief's Avatar
OP Senior Member
Flag Rome
Thanks Meter: 1,000
 
1,374 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Quote:
Originally Posted by Волк

Interesting guide. I am curious though, you have it setting permissions but have you tried it without doing so? I ask because I made a script for CWM which copies my apk's to data/app/ and I don't set permissions and have no issues. In theory you shouldn't need to, the apk should retain the proper permissions even when copied. As well, why not set the permissions for the entire contents of the folder, ie, set the permission recursively like you do for data/data and have it run at the end of the script once everything is copied?

Lastly, one thing to note with this method of installing apps is that your first boot will take awhile, the ROM has to create the Dalvik for all the apps you just flashed, I hadn't considered that when i first ran my script and thought something was wrong.

At first, i have to say to u that permissions can be not specified: i think that all the files that u put in a folder have the same permission of the folder. I set permissions only for safety.

Then, about the first boot duration, there's nothing wrong.
The system only take a while to put into effects the changes, creating the Dalvik for example.. Don't worry: it's normal!
27th May 2012, 03:39 AM   |  #9  
Волк's Avatar
Senior Member
San Francisco
Thanks Meter: 536
 
1,076 posts
Join Date:Joined: Jan 2012
Donate to Me
More
I know it's building dalvik, it simply hadn't occurred to me initially that that was the reason for it not booting. A file can have a different permission than the folder, but I think it's only that you can have the folder r/w and a file r/o. Then, on your script you can just set permissions recursively and save yourself setting permission for each app/file individually.

Sent from my LG-P999 using xda premium
27th May 2012, 05:05 PM   |  #10  
mackief's Avatar
OP Senior Member
Flag Rome
Thanks Meter: 1,000
 
1,374 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Yeah! You can just do it!

Post Reply Subscribe to Thread

Tags
flash, recovery, update, update.zip
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes