yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] fro5tie:
Hi

Would anyone be able to advise on an edify script. I want to copy a folder and all its contents, from the external sd card, to the devices internal memory.

I've looked at the mount and package_extract_dir functions but not sure on how to put it together.

Does the folder I want to copy have to be in the update.zip?
[Desire Android Development] albertobom:
Thanks a million!!!
[Desire Android Development] ENDonDESIGN:
Coolexe thanks for the TUT, it really helped me out!!!

I've read all the posts here and in a few other places but I'm still don't understand where exactly "update-binary" file comes from. Is it just a standard file I can pull out of another .zip or does one have to be compiled based off the update.zip I'm creating??

Also this is my first shot at writing one of these, if everyone could give it a once over to make sure I'm doing everything correct I would appreciate it.

I'm currently running Synergy ROM on a Samsung Galaxy SIII and they are doing nightlies, so to make things easier on myself I want to create an update.zip that will replace the TW Messaging app with the stock ICS app. Here is what I have so far..

File Structure
META-INF
|-com
|-google
|-android
|- updater-script
|- update-binary
setup
|- MmsBackToStock
system
|- app
|- Mms.apk

updater-script

ui_print("##################################");
ui_print("Package: Stock ICS Messaging app");
ui_print("Zip by: ENDonDesign");
ui_print("Replaces TW Messaging app with ICS");
ui_print("stock app");
ui_print("##################################");

show_progress 0.1 0
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
package_extract_dir("setup", "/tmp");
set_perm_recursive(0, 0, 0755, 0755, "/tmp");

ui_print("Backing up SecMms.apk...");
run_program("/sbin/busybox", "sh", "/tmp/MmsBackToStock")
show_progress 0.5 10

ui_print(" Extracting Mms.apk to /system/app");
package_extract_dir("system", "/system");
set_perm_recursive(0, 0, 0755, 0644, "/system/app");

unmount("/system");
show_progress 1 10

Here is a shell script I use to rename the old TW messaging apk

#!/system/bin/sh
#

if [ -e /system/app/SecMms.akp];
then
/sbin/busybox echo "Renaming SecMms.apk to SecMms.apk.bak";
/sbin/busybox mv /system/app/SecMms.apk SecMms.apk.bak
exit 0;
else
/sbin/busybox echo "SecMms.apk does not exist";
fi;
[Desire Android Development] MattBooth:
Something about this seems to delete my internal SD card which is really frustrating. I'm using AROMA, however the problem is in my edify script.

# Clear Data
if file_getprop("/tmp/aroma/clear.prop","selected.1") == "1"
then
ui_print("@Wiping Data...");
delete_recursive("/system");
delete_recursive("/data");
delete_recursive("/preload");
endif;
ui_print("@Clearing Cache and Dalvik...");
delete_recursive("/cache");
delete_recursive("/data/dalvik-cache");
delete_recursive("/dalvik/dalvik-cache");

The only instance of format I have is here:

format("ext4", "EMMC", "/dev/block/mmcblk0p9", "0");
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p12", "/data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/cache");
run_program("/sbin/mount", "/dev/block/mmcblk0p12", "/dalvik");
run_program("/sbin/busybox", "mount", "/sdcard");

I'm getting really confused at this.

I'm installing from the extSdCard using CWM 5.5.0.4 (CF-CWM 1.5). All references to /sdcard in my script ends up installing/copying stuff to the extSdCard and not the internal sdcard (which is mounted as /sdcard or /mnt/sdcard once the system has booted).

Nowhere in my whole edify script do I call to format or delete the whole internal sdcard. The cloest I get is delete_recursive("kryten/sdcard"); which deleted a folder I create earlier on in the script. as I'm installing from the extSdCard, it creates and removes this folder on the extSdCard correctly.

What am I doing wrong?
[Desire Android Development] DJsCrIBbLe:
I notice when dsixda kitchen makes a script the file type just says file. when i edit in notepad++ it saves as. Txt is that fine. .
[Desire Android Development] jukyO:
No. Save without extension and formatting. Otherwise you'll have errors.
[Desire Android Development] Jleeblanch:
When you save the file/script in Notepad++, choose "Save-as" and choose "All Files". Saving it with an extension will cause errors.
[Desire Android Development] DJsCrIBbLe:
Thanks worked good.
[Desire Android Development] My_galaxy:
Ok guys I'm making my first aroma but is not installing the apks. Can someone help me with the scripts for installing the apks in system app and data app my apks are in this folder

Mods/app/SamsungIME.apk

I also have flashable zip for that apk but I don't know if it will be easy just install the apk or the zip in the script please help I'm new in this

Thanks if you like it
[Desire Android Development] servabat:
Well it depends if your apks are in /data or /system folder.

Assuming that they are in /system you should do :

mount("yaffs2", "MTD", "system", "/system");
package_extract_dir("system", "/system");
set_perm_recursive(0, 0, 0755, 0644, "/system/data");
unmount("yaffs2", "MTD", "system", "/system");
[Desire Android Development] My_galaxy:
My bad but the apks that are not installing are the ones that I want to add because is installing the ROM and extra kernels but not extra apk like choices for the user thanks in advance

Thanks if you like it
[Desire Android Development] servabat:
Well how did you manage this for the moment ? Do you have some base code or are you starting from scratch ?
[Desire Android Development] My_galaxy:
OK I put all the app that I want inside the ROM and everything work but wish will be the syntax to delete only one app from inside the system app

Thanks if you like it
[Desire Android Development] bonell:
If what you want is to add apps to data folder (user apps) this syntax wil work

ui_print(" teste ");

ui_print(" teste");

ui_print(" Zip made by Bon3ll ");

run_program("/sbin/busybox", "mount", "/data");

show_progress(1, 15);

ui_print("Copying files...");

package_extract_dir("data", "/data");

unmount("/data");

ui_print("Unmounting data...");

run_program("/sbin/busybox", "umount", "/data");

ui_print("Installation complete!");
[Desire Android Development] My_galaxy:
Thanks but that don't work but I already found a way lol

Thanks if you like it
[Desire Android Development] bonell:
I´m using that code in a zip I made and it works flawlessly, it installs the system apps, and the user ones... anyway, glad you found an alternative.:)
[Desire Android Development] My_galaxy:
Thanks bro the code look ok but my rom is crazy is hybrid of cm10 and tw and is miui so something is wrong when I used that code here but I found it lol

Thanks if you like it
[Desire Android Development] My_galaxy:
Any ideas how to install a flashable zip from aroma I mean my syntax work perfect but can I do that can I just install a zip without having to do a lot more I'm still a nobie guys Thanks
[Desire Android Development] dmagician:
updater-script not working as wanted

I've came to situation - in a friend's phone (GT-I9100T android 4.0.4 LPD for all) - where device was showing warning like:

When I've dogged inside (temporary rooting and using Disk-usage from the market) I've found the log directory under data

was sized 1.7GB AND spoofed with "dumpstate_RESET_*.log" files (several hundred of them sized between 600-700KB each).

I've removed the files manually, and then came the idea to create an update.zip to do this for me (looks like this situation will appear again in a while).

script is:

show_progress(0.000000, 0);

show_progress(0.333333, 2);
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");

show_progress(0.666666, 5);
# NON-WORKING ALTERNATIVES TESTED
# -- set_perm(0, 0, 0666, "/data/log/dumpstate_TEST*");
# -- run_program("/system/bin/busybox", "rm", "-rf", "/data/log/dumpstate_TEST*");
# -- run_program("/system/bin/busybox", "rm", "-f", "/data/log/dumpstate_TEST*");
# -- run_program("/sbin/busybox", "rm", "-f", "/data/log/dumpstate_TEST*");

delete("/data/log/dumpstate_TEST*");

show_progress(0.999999, 2);
unmount("/data");
unmount("/system");

show_progress(1.000000, 0);

BUT, for some reason the files remained (this was tested on my device with 6 dummy files like "/data/log/dumpstate_TEST_2013_02_01_07_30*.log") in the directory.

No errors given while script was running...

My device details appears in my signature

Can anyone help?:confused:
[Desire Android Development] Dblfstr:
Instead of delete, try delete_recursive.

Delete is for files, delete_recursive is for a directory (folder)

show_progress(0.000000, 0);

show_progress(0.333333, 2);
ui_print("mounting systems files");

mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");

show_progress(0.666666, 5);
ui_print("Deleting dumpstate_TEST");

delete_recursive("/data/log/dumpstate_TEST");

show_progress(0.999999, 2);
ui_print("Unmounting system files");

unmount("/data");
unmount("/system");

ui_print("Success!");
show_progress(1.000000, 0);
[Desire Android Development] dmagician:
Thank you for your replay. I'll try it ASAP.
[Desire Android Development] dmagician:
Nop, not working...

tried the following two:

delete_recursive("/data/log/dumpstate_RESET_BY_CP_SILENTRESET_");
delete_recursive("/data/log/dumpstate_RESET_BY_CP_SILENTRESET_*");

without any success...
[Desire Android Development] fshami:
To delete a folder, this command works for me

delete_recursive("/data/dalvik-cache");

To delete a file:

delete("/data/yourfilename");
[Desire Android Development] dmagician:
Hello,

As you can see from my first post (#122) That WAS my first attempt, was not working for unexplained reason...

Maybe I should try a different update-binary, I don't know what else to do...
[Desire Android Development] dmagician:
First, thanks.

Second, I think mount point is fine (I have checked it by skipping the unmount("/data") command and trough shell looking in the contents of the directory - it was the correct one, data files remained), although worth checking. I'll try it.

Thanks.
[Desire Android Development] Dblfstr:
Is dumpstate_RESET_BY_CP_SILENTRESET the file, or the directory.

If it is the file, then recursive will not work. You would just use delete_recursive("/data/log");

You could try using an if to check for the file, then delete it if it is present. Do this until all files are gone?

Does the * sign work as a wildcard?
[Desire Android Development] dmagician:
Sorry, I did not understand:

I know it is files not directory.

About the second sentence, do the "if" conditional where? in the updater-script (if so, how/what are the commands) ? in the shell?

[the file names are created by the system with a time-stamp on the end, e.g. something like dumpstate_RESET_BY_CP_SILENTRESET_

20120131070000

.log - don't remember exactly - this is why my first intuitive script was delete("/data/log/..._*"), so I'm not sure if it can be done with an "if"...

I do know the only files I want to delete are dumpstate_RESET_BY_CP_SILENTRESET_* and not the other files there.

This is planned to be used on an

Un-rooted

device (so my friend will not loose the phone's warranty), this is why I've started with it...

Anyway Thanks for your replay.
[Desire Android Development] Dblfstr:
Ok, I was not sure if there were other log files in that directory that you did not want to delete. That makes things harder, especially since you cannot know the exact names of the files that you do want to delete.

I do not know the syntax for checking if a files exists. I will try to find out.

Just read this somewhere:

run_program("/sbin/sh","-c","busybox rm /data/log/dumpstate_RESET_BY_CP_SILENTRESET_*.log");
[Desire Android Development] Dblfstr:
So did this work?

run_program("/sbin/sh","-c","busybox rm /data/log/dumpstate_RESET_BY_CP_SILENTRESET_*.log");
[Desire Android Development] dmagician:
Y E S ! !

This one has get the job done. Thank you very much!
[Desire Android Development] crossfire77:
i have little query about commands.

here i write one updater script:

run_program("/sbin/busybox", "mount", "/system");
delete("/system/framework/android.policy.jar");
package_extract_dir("framework", "/system/framework");
set_perm_recursive(0, 0, 0755, 0644, "/system/framework");
package_extract_dir("app", "/system/app");
set_perm_recursive(0, 0, 0755, 0644, "/system/app");
delete("/system/lib/egl");
delete("/system/lib/libgsl.so");
package_extract_dir("lib", "/system/lib");
set_perm_recursive(0, 0, 0755, 0644, "/system/lib/egl");
set_perm_recursive(0, 0, 0755, 0644, "/system/lib/libgsl.so");
run_program("/sbin/busybox", "umount", "/system");
unmount("/system");

so i wanted to ask that should i write these mentioned like in top of my script to mount system or run_program("/sbin/busybox", "mount", "/system"); will my system.

mount("MTD", "system", "/system");
[Desire Android Development] marius.a:
depends on ur meta-inf binary.

this should work:

run_program("/sbin/busybox", "mount", "/system");
[Desire Android Development] crossfire77:
okay so for anything

run_program("/sbin/busybox", "mount", "/system");

will work?

no need to use mount("MTD", "system", "/system");

right?

&

also

can you explain little about show_progress syntax.like how to use and what i see after using this command?

show_progress(fraction,duration)
fraction = a fraction of the bar (more on that in a moment)
duration = seconds
[Desire Android Development] marius.a:
you don't need both. both do same think in different way.
[Desire Android Development] crossfire77:
i need your help in one command.

delete_recursive("/system/etc/bolt_scripts");

this command will also delete bolt_scripts directory from system.

so which command should i used if i just wanted to delete all files from bolt_scripts directory but bolt_scripts directory will remain as it is in system.my meaning only file will be deleted no directory.
[Desire Android Development] marius.a:
either delete one by one. either delete recursive and put back thw folder empty.
[Desire Android Development] crossfire77:
okay what's command for creating new folder?
[Desire Android Development] marius.a:
mkdir

use it with busybox
[Desire Android Development] crossfire77:
can you explain little.

i am deleting this directory

delete_recursive("/system/lib/modules");

so how to use busybox to create modules directory again.

i found this.can you write me from this command.

run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
[Desire Android Development] marius.a:
to create a folder, do like that:

run_program("/sbin/busybox", "mkdir", "-p", "/system/lib/modules

in your zip you can have also folder named "modules"

in this case you just

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

don't forget to set permisions after
[Desire Android Development] Bob Smith42:
1) When I install enabletether-JOP40C.zip (see link below) it works, but I do not understand why.

Zip file source:

http://xdaforums.com/showthread.php?t=1995737

[MOD][4.2.1/4.2][JOP40D/JOP40C] Tethering/Wifi Hotspot for the Nexus 7 3G

On my system there is no "/sbin/busybox", but in the updater script the partition is mounted using:

run_program("/sbin/busybox", "mount", "/system");

2) I am using ClockworkMod Recovery v6.0.1.9 to "install zip from sdcard". I see no errors. It just works.

Here are some questions:

A If run_program fails will the script continue?

B Is it possible run_program works by finding my installed busybox (not in /sbin)?

C Is it possible CWM Recovery mounts the system partition as part of install zip from scard task?

Suggestions or thoughts please?
[Desire Android Development] deveshmanish:
So I'm trying to create a patch which requires copying a folder from system to system/etc under a different folder name.

I've tried this copy_dir("/system/bootmenu/2nd-init","/system/etc/rootfs");

but it's giving me code 6 error.

How will I achieve this???

Any help is appreciated..
[Desire Android Development] TheByteSmasher:
The Story:

Normally I can replace the APKs in the Gapps with the latest version from the Play Store.

For some reason, the newest version of google search DOESN'T work if it's thrown in as a replacement (Making the newest version a system app).

Google search only works if the original Gapps version is installed as a system app, THEN the newest version can only be installed as an "update" (like if you did update via the Play Store).

That is what I'm trying to attempt... package_extract_dir the original into system/app THEN Install the newest version as an update (into data/app), thus preventing the necessity of the user having to perform the update upon first boot..

Everything about my modded script works except this!

What I have:

ui_print("Installing Purely Merged Google Apps for Android 4.2.2..");

ui_print(" ");

ui_print("Mounting system...");

run_program("/sbin/busybox", "mount", "/system");

ui_print("Mounting data...");

run_program("/sbin/busybox", "mount", "/data");

show_progress(1, 15);

delete("/system/app/Provision.apk","/system/app/QuickSearchBox.apk","/system/app/SetupWizard.apk","/system/app/Velvet.apk","/system/app/Vending.apk","/system/app/BrowserProviderProxy.apk","/system/app/PartnerBookmarksProvider.apk","/system/app/Gmail2.apk","/system/app/GoogleEars.apk","/system/app/Calendar.apk","/data/app/com.google.android.googlequicksearchbox-1.apk");

ui_print("Copying files...");

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

set_perm(0, 0, 0755, "/system/addon.d/70-gapps.sh");

package_extract_dir("optional", "/tmp");

package_extract_file("install-optional.sh", "/tmp/install-optional.sh");

set_perm(0, 0, 0777, "/tmp/install-optional.sh");

run_program("/tmp/install-optional.sh", "");

show_progress(1, 15);

ui_print("Fixing Permissions...");

set_perm_recursive(0, 0, 0755, 0644, "/system/app");

package_extract_dir("data", "/data/appcom.google.android.googlequicksearchbox-1.apk");

set_perm(0, 0, 0644, "/data/app/");

ui_print("Unmounting system...");

run_program("/sbin/busybox", "umount", "/system");

ui_print("Unmounting data...");

run_program("/sbin/busybox", "umount", "/data");

ui_print("");

ui_print("|=========================================|");

ui_print("|Purely Merged Google Apps Installation |");

ui_print("| is complete |");

ui_print("|=========================================|");
[Desire Android Development] thewalekk:
Hi guys. what i wanna ask is...

So we create a folder with "mkdir"

delete a folder with "rm"

copy files with "cp"

but pls can someone explain me what is this "-p" "-f" "-s" or other letters mean?

where can i find a source that explains this codes and their usage?
[Desire Android Development] UtCollector@gmail.com:
I think -f is for force. Myself i install programs this way.

The -s is for silent i think. Means without user interferance. I used this with silent installers in the past.

-p? I dont know. Google.

Anyone know what the problem is with this script?

http://pastebin.com/jRGffrah

Im building a cm version for a tablet. But i get a status 6 when i try and flash the file. This is the log of the updaterscript: http://pastebin.com/jRGffrah

This is the problem if the info in the log file is right:

line 92 col 28661: unknown function ¨retouch_binaries¨ 1parse errors
[Desire HD Q&A, Help & Troubleshooting] mariosraptor:
AS the title states, is HTC slowly becoming a Samsung clone, as about software updates?

I even sent a message to them 5 days ago, asking about delivery of official 2.3 and no response yet. WTF?

I bought an HTC phone (actually 3 in a row, Magic-Desire-Desire HD) cause i thought that they were much better than Samsung in support. That is why all of us bought their flagship phone.

Maybe is time to go for Atrix or Optimus 2X when they appear.
[Desire HD Q&A, Help & Troubleshooting] CitizenLee:
The simple answer is no, they wont.

You'll get 2.3 on your DHD eventually, just be patient! Would you rather they rush it and it be full of bugs, or they take their time and it be have less bugs?

If you want fastest updates trade DHD for Nexus S ;)

PS - You think Samsung are bad? LG are worse!
[Desire HD Q&A, Help & Troubleshooting] mariosraptor:
thanks. but if Ns was available in Greece i would. The that has made me mad is that the aren't even answering at all.
[Desire HD Q&A, Help & Troubleshooting] AndroHero:
Google only recently released the source code, do you expect htc to port sence over night? :confused:
[Desire HD Q&A, Help & Troubleshooting] chrisr27:
I don't think they should port sense overnight... but...its like nearly 2months now. What annoys me with HTC is you buy their latest flagship device, only to find you get gazzumped a couple of months later by a different device with a newer software..and makes you think is there any point in buying latest HTC handsets when this happens...or maybe its Googles fault, if they communicated better instead of saying at the end of the summer 'Gingerbread is on its way', and actually said when its arriving and on what etc ppl could make better choices.

Added to this is that by the time they do release an update, the phones a year old, theres newer ones...you get one...then its groundhog day again. No doubt HTC have another DHD coming out soon with a front facing camera bla bla bla anyway, and also i think the reason they take so long is that its not a priority to them, their priority is investing their resources in pushing out yet newer handsets just to snare new victims..

btw for anyone, i asked HTC about an update about 2 weeks ago, they told me they wont be releasing one and to contact my network carrier...network carrier pointed me back to HTC.

anyway , rant over
[Desire HD Q&A, Help & Troubleshooting] CitizenLee:
That's just how it works though.

You buy something and a few months later it's out of date.

It's the way of the tech world and has been for years.

There's no malice or trickery involved, it's just business.
[Desire HD Q&A, Help & Troubleshooting] chrisr27:
Maybe my insinuation of malice and trickery is a little unfair..but having said that, I guarantee if Id contacted HTC before buying the DHD in October and asked wld it get Gingerbread update they would have said 'sure, course you will, everyone gets updates'..knowing full well it wld take months and months to get the updates.

And if I'd contacted Google and said I was thinking of buying an android handest when is latest software gona be incorporated, they would have said 'we arent sure' just so I would get the DHD another registered android device for them...even though they know full well the likely release, and handsets that will release with it way in advance...so in a sense it is trickery, but guess thats business for you...neither wants to jeopardise a potential sale for their stats

so the snare is recoiled ready for the next victim :D
[Desire HD Q&A, Help & Troubleshooting] leppie:
I wonder how hard it can really be... they probably just dont have any friggen (unit/automation) tests. The API from 2.2 to 2.3 has barely changed. Imagine you had to wait for a new Ubuntu release just to get a kernel update...

Given they managed to screw up the 1.72 release and havent even uploaded the source code for that kernel, does not make me very enthusiastic about actually seeing 2.3 out anytime in the next 6-9 months.
[Desire HD Q&A, Help & Troubleshooting] AndroHero:
I'm sure if enough people emailed htc and quoted the gpl, htc would have to release the source, after all it states the source should be made availible on request :)
[Desire HD Q&A, Help & Troubleshooting] Yamthief:
The software updates all work on about a 6 month cycle (give or take). It's made very clear from the outset that new software is in the pipelines, they just don't set a concrete date, they just simply release it when it's ready.

The same can be ready for HTC. They're actually good with a lot of their updates in comparison to a lot of manufacturers. There are a few devices which never even got an update to 1.6.

HTC will release an update when it's ready.

If you don't want to wait, install a CyanogenMod ROM.