yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Binary100100:
Yeah. Why?

I was creative as you suggested and came up with this that seems to work pretty well so far. I noticed that the screen cannot hold anymore than 32 characters (in recovery) so I had to compromise.

ui_print("Welcome to Community Hero Mix! Designed by Binary100100");
show_progress(0.500000, 0);
mount("MTD", "system", "/system");
delete("/system/app/ADWLauncher.apk", "/system/app/Browser.apk",
"/system/app/Calculator.apk", "/system/app/Calendar.apk",
"/system/app/Camera.apk", "/system/app/CMParts.apk",
"/system/app/CMPartsHelper.apk", "/system/app/CMWallpapers.apk",
"/system/app/Contacts.apk", "/system/app/DeskClock.apk",
"/system/app/Email.apk", "/system/app/Gallery3D.apk",
"/system/app/Gmail.apk", "/system/app/Mms.apk",
"/system/app/Music.apk", "/system/app/Phone.apk",
"/system/app/Settings.apk", "/system/app/SoundRecorder.apk",
"/system/app/QuickSearchBox.apk", "/system/app/VoiceDialer.apk",
"/system/framework/framework-res.apk", "/system/framework/framework.jar",
"/system/media/bootanimation.zip");
package_extract_dir("system", "/system");
ui_print(" First time flashing Community Hero Mix and want white text? Settings -> CyanogenMod settingsUser Interface -> Tweaks extras Select a theme: Select Community_Hero_Mix Press OK to reboot and apply!");
show_progress(0.200000, 0);
mount("MTD", "userdata", "/data");
package_extract_dir("userdata", "/data");
mount("MTD", "sdcard", "/sdcard");
ui_print(" Thanks for applying Community Hero Mix by Binary100100. Comments and suggestions can be made on XDA-Developers forum. Donations are always appreciated");
package_extract_dir("sdcard", "/sdcard");
show_progress(0.100000, 0);
unmount("/system");
unmount("/data");
unmount("/sdcard");

I added 32 blank spaces to create a seperate line in a few spots. Looks sloppy but it worked. :)
[G1 Android Development] RichieDaze:
This I don't understand. Some times I can place it anywhere and it would work. Sometimes only in the beginning. Make sure that it correctly written. Try different methods and use what works...
[G1 Android Development] Binary100100:
I appreciate your help Richie! :D
[G1 Android Development] rocyang:
Thanks！！！Thank you, I am troubled by this!!!!!
[G1 Android Development] rPAD:
Just trying to create an update package that deletes files first and then writes in a few little ones back into it.

this code is in the file "updater-script" with the "update-binary" in the same directory. i zip the files and then sign them and i get a (status 6) error code and then installation aborted.

can anyone help me?

ui_print("Modded by rPad");

show_progress(0.500000, 0);

mount("MTD", "system", "/system");

delete("/system/app/CMStats.apk", "/system/app/DeskClock.apk", "/system/app/DFParts.apk", "/system/app/DFPartsHelper.apk", "/system/app/DSPManager.apk", "/system/app/Email.apk", "/system/app/FileManager.apk", "/system/app/FM.apk", "/system/app/GoogleFeedback.apk", "/system/app/GoogleQuickSearchBox.apk", "/system/app/googlevoice.apk", "/system/app/HTC_IME_hi22.apk", "/system/app/HtcCopyright.apk", "/system/app/HtcEmailPolicy.apk", "/system/app/LatinImeTutorial.apk", "/system/app/LiveWallpapers.apk", "/system/app/LiveWallpapersPicker.apk", "/system/app/MagicSmokeWallpapers.apk", "/system/app/Music.apk", "/system/app/OneTimeInitializer.apk", "/system/app/PicoTts.apk", "/system/app/Protips.apk", "/system/app/SetupWizard.apk", "/system/app/SoundRecorder.apk", "/system/app/soundback.apk", "/system/app/Street.apk", "/system/app/Stk.apk", "/system/app/Street.apk", "/system/app/Talk.apk", "/system/app/talkback.apk", "/system/app/Torch.apk", "/system/app/TtsService.apk", "/system/app/VoiceDialer.apk", "/system/app/VoiceSearch.apk", "/system/app/VisualizationWallpapers.apk", "/system/app/Bluetooth.apk", "/system/etc/NOTICE.html.gz");

package_extract_dir("system", "/system");

unmount("/system");

ui_print("Completed");
[G1 Android Development] crisvillani:
hey guys im trying to make a new rom but every time itry to flash i get installation aborted E: Can't Find Update Script

i now thereis an update script in the META-INF, also i checked if there were any errors with it with Dxsida rom kitchen, also i made the update script with Dxsida rom kitchen. i new to this and i will be very glad if someone could help me !:D

thx.
[G1 Android Development] Firerat:
is it update-script or updater-script ?

if it is updater-script do you also have update-binary ?

are you using the correct syntax in your script? ( update and updater are different )

reads like you are kanging anyway, so kang the scripts as well
[G1 Android Development] crisvillani:
it was an updater-script but i changed it to update-script using kitchen, also the base is the tmobile ota 2.2
[G1 Android Development] Firerat:
I see, so what do you think the problem might be?

what did you change?
[G1 Android Development] crisvillani:
i tryed making the rom all over again this time try to leave update-script alone hopefully this tim it will work.:D
[G1 Android Development] RichieDaze:
Don't forget...

Always remember that the /data file tree is created at boot if its wiped or not present.

Beware!!!

When placing new folders into data, you should be aware that your new folders will change the owner and permissions of that folder and files in it.
[G1 Android Development] :
Hey guys,

I need to create some folders in /cache when I flash my device. How would that be done?

Because there is a file called recovery.img in. Is this just a backup? I dont want to brick my phone. :-)
[G1 Android Development] RichieDaze:
A long time ago people used to place the recovery.img in the update.zip. Nowadays it's flash separately to avoid problems and to keep your personal preference.

recovery.img is the recovery partition of your phone where you flash your update.zips (ex: JF,Cyan,RA or Clockwork recovery.img's)

Unless you want to change your recovery with the update, leave it alone...

If you do, just ask on how to do that....
[G1 Android Development] :
Ok thanks...

I think I put the files in /data instead.

But if i write in my update-script:

copy_dir PACKAGE:data DATA:

does this mount /data so I can run a coustom script with:

run_program PACKAGE:myscript

or does it erase my data partition and all my other files are gone? I will do a fresh nandroid backup just in case. But it would be cool to understand what its realy does before I try it.
[G1 Android Development] Firerat:
get your script to mount data if you need it mounted ;)

#!/sbin/sh
if [ "$(busybox grep -q /data\$ /proc/mounts;echo $?)" != "0" ];
then
busybox mount /data
fi

or just don't bother checking and

busybox mount /data

no-one will really see the error it spits out unless they read the recovery.log
[G1 Android Development] RichieDaze:
This code is just in case you want to wipe your data partition

format("MTD", "data");

This code mounts /data on userdata and copies the data folder from the update.zip to /data.

mount("MTD", "userdata", "/data");
package_extract_dir("data", "/data");

If your using a script, I would use Firerats first method.

Just in case you want to run the script:

package_extract_file("location-of-script/script.sh", "/tmp/script.sh");
set_perm(0, 0, 0777, "/tmp/script.sh");
run_program("/tmp/script.sh");
[G1 Android Development] :
Ok thank you, the method of firerat looks good for my needs.
[G1 Android Development] nachobkcc:
need help

This thread is great!!! It was (is) very usefull for benginers like me :)

1) Im trying to get an update zip working and i can't find my mistake!

Mi idea is to create an after flash rom patch with my usual apps, so i don't have to manually install them (or use any app to do that).

Zip file structure:

/data/app/apps.apk

/META-INF/CERT.RSA

/META-INF/CERT.SF

/META-INF/MANIFEST.MF

/META-INF/com/google/android/update-script

update-script content

copy_dir PACKAGE:data DATA:

The flashing process finishes ok, but it doesn't copy the apps to /data/app.

----

2) Another thing I don't get is how to run the "script.sh"

is it a sentence on the update-script that runs it??

run_program PACKAGE:script.sh

or

package_extract_file("location-of-script/script.sh", "/tmp/script.sh");
set_perm(0, 0, 0777, "/tmp/script.sh");
run_program("/tmp/script.sh");

if i get to run the script, it would be

mount("MTD", "userdata", "/data");
package_extract_dir("data", "/data");

suposing that script.sh is on the root of the zip file

(am I mixing everyrhing ?)

----

I apreciate all that you do here and any help you can give!

Im sorry if this sounds stupid, but im learning from almost cero.

Thanks anyway!
[G1 Android Development] jim_panse:
How do i create a update-binary?
[G1 Android Development] Firerat:
compile it
[G1 Android Development] jim_panse:
And how do i compile it? I have a working updater-script and took a update-binary from an other update.zip. But i want do make my own binary. Can you point me into a direction?
[G1 Android Development] Firerat:
http://developer.android.com/index.html
[G1 Android Development] jim_panse:
A little more into the right direction? I searched update.zip and other terms but nothing which helped me
[G1 Android Development] Firerat:
http://developer.android.com/index.html

http://developer.android.com/index.html

http://developer.android.com/index.html

http://developer.android.com/index.html
[G1 Android Development] jim_panse:
You are a funny guy... Search term or anything?

But thank you for the direction!
[G1 Android Development] Firerat:
why are you so desperate to make your own update-binary, when the one you kanged will work perfectly fine?
[G1 Android Development] jim_panse:
Because i want to learn more about it. Its just a thing about interest in this things.
[G1 Android Development] ezterry:
If it helps its in the full android build.. if you are looking source code look under bootable recovery under updater..
[G1 Android Development] Firerat:
http://wiki.cyanogenmod.com/index.php?title=Special:Search&search=compile&go=Go
[G1 Android Development] maximumx2:
Help please...

Hi @ all

Very nice thread. Hope you can understand me because i usually speak german.

Here's my problem:

I have an update.zip with an APK in it, the meta folder, the update-binary and the updater-script.

Here's the code:

show_progress(0, 0);

ui_print("Mounting System Partition...");

mount("MTD", "system", "/system");

ui_print("Erasing Old Launcher...");
delete("system/app/TouchWiz30Launcher.apk", "system/app/TouchWiz30Launcher.odex");
ui_print("Completed Erasing !");

ui_print("Extracting New Launcher...");

package_extract_file("TouchWiz30Launcher.apk", "/system/app/TouchWiz30Launcher.apk");

ui_print("Completed Extracting !");

unmount("/system");

ui_print("Unmounting System Partition...");
show_progress(10.000000, 1);

ui_print("Done !");
ui_print("--------------------------");
ui_print("Script by Maximum-X2");

but everytime i run it, my galaxy s with CWM-Recovery tells me:

-- Installing: SDCARD:update.zip
Finding update package...
Opening update package...
Installing update...
E:Error in /mnt/sdcard/update.zip
(Status 6)
Installation aborted.

Hope you guys can help me.

Thanks in advice.

Chris
[G1 Android Development] ezterry:
I can't say I see a problem off the top of my head (but I'm sleepy and have been dealing with much more complicated edify scripts today)

One good thing to do is look at /tmp/recovery.log as this is where any syntax errors will be reported
[G1 Android Development] maximumx2:
Sorry but i have no recovery.log.

My recovery is a special version vor the voodoo kernel.

I dont know what else i can do. I read every single post of this thread but i dont see the problem.
[G1 Android Development] xue2ye:
what is the update-binary use for？

what is the update-binary use for？
[G1 Android Development] ezterry:
reading and executing updater-script using edify
[G1 Android Development] xue2ye:
and if i just copy one update-binary from someone's update.zip.Then i change the scipt.Can it work?Should I change the binary file?
[G1 Android Development] naboleo:
I do need some more details about this!

Tried to update my script adding

mount("yaffs2", "MTD", "data", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(0, 0, 0755, 0755, "/data/local/bin");
unmount("/data");

Seems to me that it works fine during the script exec step as i can see /data/app content with Apk Manager

But after reboot, folder is empty...

Is there something to make data permanent ?
[G1 Android Development] RichieDaze:
MTD name is incorrect, it should be userdata...
[G1 Android Development] naboleo:
Thanks RichieDaze for your reply

Updated my script accordingly but behavior is the same at the very end.

Ii don't understand where the "userdata" MTD value comes from ! Had a look in fstab and mount but no reference to userdata

Anyway I did some more tests :

*Script with data MTD value+ apk in data/app directory from rom zip => no app in /data/app

*Script with userdata MTD value + apk in data/app directory from rom zip => no app in /data/app

*Script with userdata MTD value + apk in userdata/app directory from rom zip => no app in /data/app

If my apk are included in /system/app everything is fine but can't apply update easily, that's why I want to move some of these. By the way i'm using the Oxygen v2.0-RC5 as base rom.

Is something still wrong in my script (my steps are located at the very end of it) or does something else (another script) is erasing or formating my /data/app content at the first boot ?
[G1 Android Development] Jimmothy:
Hi Richie, I've written the following updater-script and pinched the update-binary from Oxygen 2.0-RC1

### Display welcome msg
ui_print("Android Backup v1.0");

### Tell the user we're mounting /data and /system
ui_print("Mounting /system");
mount("MTD", "system", "/system");
ui_print("Mounting /data");
mount("MTD", "userdata", "/data");

show_progress(0.300000, 0);

### Tell the user we're copying stuff to /data
ui_print("Restoring backed up data to /data & /system");
package_extract_dir("data", "/data");
package_extract_dir("system", "/system");

show_progress(0.200000, 0);

### Tell the user we're setting permissions
ui_print("Setting permissions");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0755, 0644, "/data/app");
set_perm(0, 0, 0644, "/system/etc/apns-conf.xml");
set_perm(0, 0, 0644, "/system/etc/hosts");
set_perm(0, 0, 0755, "/system/bin/fix_permissions.sh");
set_perm(1000, 1010, 0660, "/data/misc/wifi/wpa_supplicant.conf");
package_extract_file("/system/bin/fix_permissions.sh", "/tmp/fix_permissions.sh");
set_perm(0, 0, 0777, "/tmp/fix_permissions.sh");
run_program("/tmp/fix_permissions.sh");

show_progress(0.100000, 0);

### Tell the user we're unmounting file systems
ui_print("Unmounting Filesystems");
unmount("/data");
unmount("/system");

### Tell the user the backup is complete
ui_print("Restoration complete");

It fails with the error:

mount() expects 4 args, got 3
E:Error in /sdcard/james-data-050111-signed.zip (Status 7)

right after trying to mount /system and /data.

Could you tell me where I'm going wrong?

Any help is appreciated. :)
[G1 Android Development] Firerat:
your updater-bin want the filesystem

mount("yaffs2", "MTD", "system", "/system");
[G1 Android Development] Jimmothy:
Bang on!

Cheers. It works now. :)
[G1 Android Development] naboleo:
Thanks Jimmothy for your script. I guess I was missing some permissions for /data and /data/app. Replaced mine with yours and it works fine !
[G1 Android Development] RichieDaze:
You also forgot to add user in the package_extract_dir command.

Blonde moment! But I'm not blonde:D

***Edit:Not necessary for the package_extract_dir command

The MTD name for the data partition is userdata and it mounts to a folder named /data.
[G1 Android Development] Jimmothy:
No problem :) Not such where I stole it from, I was very tired.

On another note, do any of you know what can be backed up to restore gmail, wifi etc? To avoid the "touch the android to begin" process.

Edit: I'm not entirely sure the fix_permissions.sh is working.
[G1 Android Development] naboleo:
Could be interresing to know
[G1 Android Development] naboleo:
Found a part of it : /data/system/account.db ... and discovered that my exchange account password isn't even encrypted !!!!!
[G1 Android Development] Firerat:
re-read it

package extract does not concern itself with mtd partitions, it is looking in the zip, and putting to phones fs
[G1 Android Development] RichieDaze:
Oh shhhht.

He is right, that happens when you speed read half asleep...

Thanks for the correction...
[G1 Android Development] wcg707:
I'm trying top write a script that will install and copy some files into system folder. It seems to be working with some roms and fail to execute the script in some.

My script is a very simple script which contain the following lines:

show_progress 0.5 0
copy_dir PACKAGE:system SYSTEM:
set_perm_recursive 0 0 0755 0755 SYSTEM:/bin/openvpn
set_perm recursive 0 0 0755 0755 SYSTEM:/etc/init.d/

show_progress 0.5 7

My system folder in the update.zip contains the following tree:

system--> etc > init.d > script.sh

--> bin > openvpn

--> xbin > filename

During the installation, all the system folders were created correctly. However the init.d/script.sh which is supposed to execute upon reboot is not doing it is some roms.

My script.sh also contain a very simple stuff:

#!/bin/sh
busybox mount -o remount,rw /system;
busybox ln -s /system/bin/ifconfig /system/xbin/bb/ifconfig;
busybox ln -s /system/bin/route /system/xbin/bb/route;

Question is,

1. Can I incorporate the script.sh to the update.script directly using symlinks?How do I do this?

2. What is the difference between busybox and toolbox?

Thanks
[G1 Android Development] Droidzone:
A little more explanation on permissions would be nice. :)
[G1 Android Development] Firerat:
set_perm_recursive 1002 1002 0755 0440 SYSTEM:etc/bluez

set_perm_recursive <owner> <group> <dir permission> <permission of files/dir below dir> <file/dir to operate on>

set_perm 0 0 0755 SYSTEM:etc/bluez

set_perm <owner> <group> <permission of files/dir below dir> <file/dir to operate on>
[G1 Android Development] Droidzone:
Thank you!

Suppose I want to do this in Adb:

chmod 755 /system/xbin/busybox
chown 0.0 /system/xbin/busybox

How does that translate to update-script?

Is this it?

set_perm 0 0 0755 SYSTEM:xbin/busybox
[G1 Android Development] Firerat:
yeap, that is exactly it

remember that set_perm needs to come after a set_perm_recursive which is 'higher' in the dir tree
[G1 Android Development] Droidzone:
Thanks..

Two more commands..

/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O ^has_journal,extents,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
and

:> /system/etc/mtab

Can these two commands done in update-script?

As you may have guessed, these are commands for Data2sd..The only two commands lying between me and my new Data2sd rom! :)
[G1 Android Development] Firerat:
not directly

but you could do it via a script ran by the update script

e.g.

data2sdscript.sh

#!/sbin/sh

# make sure system is mounted
mount /system
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O has_journal,extents,huge_file -m 0 -L userdata /dev/block/mmcblk0p2

run_program PACKAGE:data2sdscript.sh

assumes the script is in the root of the zip

if it were in scripts dir

run_program PACKAGE:scripts/data2sdscript.sh

imo, data2sd is terrible, but each to their own

edit:

mke2f might be missing from a ROM, so include it in your zip and extract it to memory

it is best done with the new updater-script

pull apart my customMTD zip to see how I do similar thing

http://www.mediafire.com/?u8k1uhx1juazm

github

https://github.com/Firerat/CustomMTD

note, the above v1.5.8-beta is on the unstable branch( and tagged ), I'll be moving it to the stable branch soon, ( when I get round to it ;) )
[G1 Android Development] Droidzone:
Thanks, Firerat. You're awesome! A little help on these and I'm done..

:> /system/etc/mtab
cd /data
cp -a * /sd
cd /
sync

You're the first person on the credit list for my Rom! :)
[G1 Android Development] Firerat:
I added a bit, may prove useful
[G1 Android Development] Droidzone:
Wow..It's a bit hardcore.. :)

So anything that can be executed via the 'adb shell" can be included in the .sh script?
[G1 Android Development] Firerat:
basically yes

I started using shell script to automate simple commands

but later as they got more complicated and the script was running 'bind' I started including logic

for example , lets assume that mounting system again would be a bad thing

we would add use this

if [ "$(busybox grep -q "/system" /proc/mounts;echo $?)" != "0" ];
then
mount /system
if [ "$?" != "0" ];
then
echo "system could not be mounted .. not procedding"
exit 1
fi
fi

when you get into testing stuff like that you can send your script in different places

if , elif , else

can be very powerful stuff

http://www.freeos.com/guides/lsst/

a little more advanced

http://tldp.org/LDP/abs/html/
[G1 Android Development] Droidzone:
Can't thank you enough! Very useful. I've been asking around a lot for this info, and today I got a real answer!
[G1 Android Development] Droidzone:
@Firerat,

Is it possible to provide text output via the update-script? I've seen lots of roms using updater script for that, but havent seen any doing that with update-script..

If it isnt possible, how does one use the scripting shell to provide such output?

Eg: I just want to say.. "Now copying files.." etc
[G1 Android Development] Firerat:
with the newer updater-script you use

ui_print("your text");

don't think you can with the older update-script

one thing I want to look at is printing custom feedback based on what a shell script spits out

I got interested in that possibility after seeing ezterry's safe 2825 radio flasher

in it he uses if conditions which tested against what a script wrote to a file.

i.e.

I want my customMTD flashers to report success and failure

( and in the case of failure , why it failed )

which should be straight forward

these could be easily hardcoded,

e.g.

fail=yes
failcode=4

if fail = yes
then
if failcode = 1
then
print msg for failcode 1
else if f failcode = 2
hen
print msg for failcode 2
......

but I want to go a little further and also report what size partitions were set as, it would be clumsy to use simple if elif to do this as there would be many.

so I want to explore the possibility of printing a variable

haven't got round to looking at this yet, I suspect I may need to modify the edify code ( which is what the update-binary is compiled from )
[G1 Android Development] Droidzone:
Would love to see your progress on that..

Is there a good guide on updater-script? The dsixda kitchen seems to prefer the update-script though..
[G1 Android Development] Firerat:
the most info I have seen for updater-script is in this thread tbh

but ezterry did tip me to look at the source, which I will at some point

http://android.git.kernel.org/?p=pl...c7b5a34edac9d3513569ce4871e3becef3bed;hb=HEAD

readme here

http://android.git.kernel.org/?p=pl...455ccaa829bc326969ffa580a320289e62f08;hb=HEAD

I learnt how the update-script worked by looking at the code for recoveries

it was before this thread was created ;)
[G1 Android Development] Droidzone:
By the way, wanted to thank you once again for all the help on the update-script. With your help, I was able to create a flashable zip for Sibere's Data2SD..Sibere has now updated his thread with this zip. It's quite a big progress for Data2sd..Made it go from one which was meant only for devs, to one that can be used even by newbies!
[G1 Android Development] Droidzone:
Few more qn..

How does one install an apk as part of the rom install?

When I include some apks in /data/app, I've noted that some of them do not get installed, though the files get copied. Maybe its a permission issue?

At times b/c of wrong scripts, the boot after a rom install does not proceed into the boot_animation stage, and stalls at the main screen. Is there any way to find out what's going wrong at this point? Like if the system were on, we have logcat.