Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,732,310 Members 45,498 Now Online
XDA Developers Android and Mobile Development Forum

[TUTORIAL] Create your own UPDATE.ZIP

Tip us?
 
mackief
Old
(Last edited by mackief; 16th October 2012 at 12:31 PM.)
#1  
mackief's Avatar
Senior Member - OP
Thanks Meter 993
Posts: 1,374
Join Date: Mar 2012
Location: Rome

 
DONATE TO ME
Question [TUTORIAL] Create your own UPDATE.ZIP

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, 13251 views)


MOLTENMOTHERBOARD
---------------------------------------------------------------
.--> General, Q&A, Help thread
.--> Following Projects
---------------------------------------------------------------




.
The Following 54 Users Say Thank You to mackief For This Useful Post: [ Click to Expand ]
 
The_Steph
Old
#2  
Senior Member
Thanks Meter 274
Posts: 753
Join Date: Mar 2007
Location: Paris
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?
The_Steph

My Galaxy Note II is using latests Nameless ROM stripped to the bone, latest TeamWin's Recovery Project
TWRP recovery and an exFAT formatted SanDisk 64GB SDXC card
HTC Artemis -> HTC Polaris -> HTC Blackstone -> HTC Leo -> HTC Ace -> Samsung Galaxy Note -> Samsung Galaxy Note II -> Oppo Find 7a

And if what I wrote helped you, be kind... click on Thanks button
 
mackief
Old
#3  
mackief's Avatar
Senior Member - OP
Thanks Meter 993
Posts: 1,374
Join Date: Mar 2012
Location: Rome

 
DONATE TO ME
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?


MOLTENMOTHERBOARD
---------------------------------------------------------------
.--> General, Q&A, Help thread
.--> Following Projects
---------------------------------------------------------------




.
The Following User Says Thank You to mackief For This Useful Post: [ Click to Expand ]
 
The_Steph
Old
(Last edited by The_Steph; 23rd May 2012 at 09:23 AM.)
#4  
Senior Member
Thanks Meter 274
Posts: 753
Join Date: Mar 2007
Location: Paris
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, 1639 views)
The_Steph

My Galaxy Note II is using latests Nameless ROM stripped to the bone, latest TeamWin's Recovery Project
TWRP recovery and an exFAT formatted SanDisk 64GB SDXC card
HTC Artemis -> HTC Polaris -> HTC Blackstone -> HTC Leo -> HTC Ace -> Samsung Galaxy Note -> Samsung Galaxy Note II -> Oppo Find 7a

And if what I wrote helped you, be kind... click on Thanks button
The Following User Says Thank You to The_Steph For This Useful Post: [ Click to Expand ]
 
vua777
Old
#5  
vua777's Avatar
Senior Member
Thanks Meter 90
Posts: 558
Join Date: Jun 2005
good lession for tweaking my one x
* Phone: O2 Mini (Magician) ► O2 trion (Hermes) ► HTC Touch HD (Blackstone) & HD2 (Leo) ► White HTC One X (Endeavor) ► Red HTC One (M7)

* Tablet: Galaxy Tab Plus (P6200)
 
mackief
Old
#6  
mackief's Avatar
Senior Member - OP
Thanks Meter 993
Posts: 1,374
Join Date: Mar 2012
Location: Rome

 
DONATE TO ME
Quote:
Originally Posted by vua777 View Post
good lession for tweaking my one x
I'm glad do help you!

Quote:
Originally Posted by The_Steph View Post
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!


MOLTENMOTHERBOARD
---------------------------------------------------------------
.--> General, Q&A, Help thread
.--> Following Projects
---------------------------------------------------------------




.
The Following User Says Thank You to mackief For This Useful Post: [ Click to Expand ]
 
Волк
Old
#7  
Волк's Avatar
Senior Member
Thanks Meter 535
Posts: 1,067
Join Date: Jan 2012
Location: San Francisco

 
DONATE TO ME
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.
Remember guys: Волк = Volk (Google it for a translation)

Devices: G2x (sold), Nexus 7 32GB Wifi (bricked), Nexus 5


G2x AIO wipe tool 20 November, made with AROMA and includes AROMA File manager!

G2x AIO

New 29 Sept
AIO wipe tool O2x version

6 October
AIO wipe tool G2/DZ version

[Nexus 5 version available via pm, though haven't seen a need for it with this phone]
 
mackief
Old
#8  
mackief's Avatar
Senior Member - OP
Thanks Meter 993
Posts: 1,374
Join Date: Mar 2012
Location: Rome

 
DONATE TO ME
Quote:
Originally Posted by Волк View Post
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!


MOLTENMOTHERBOARD
---------------------------------------------------------------
.--> General, Q&A, Help thread
.--> Following Projects
---------------------------------------------------------------




.
 
Волк
Old
#9  
Волк's Avatar
Senior Member
Thanks Meter 535
Posts: 1,067
Join Date: Jan 2012
Location: San Francisco

 
DONATE TO ME
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
Remember guys: Волк = Volk (Google it for a translation)

Devices: G2x (sold), Nexus 7 32GB Wifi (bricked), Nexus 5


G2x AIO wipe tool 20 November, made with AROMA and includes AROMA File manager!

G2x AIO

New 29 Sept
AIO wipe tool O2x version

6 October
AIO wipe tool G2/DZ version

[Nexus 5 version available via pm, though haven't seen a need for it with this phone]
 
mackief
Old
#10  
mackief's Avatar
Senior Member - OP
Thanks Meter 993
Posts: 1,374
Join Date: Mar 2012
Location: Rome

 
DONATE TO ME
Yeah! You can just do it!


MOLTENMOTHERBOARD
---------------------------------------------------------------
.--> General, Q&A, Help thread
.--> Following Projects
---------------------------------------------------------------




.

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

Advanced Search
Display Modes