Trying to learn about the updater script. I have looked at a few from digiblur and others. I can't seem to get it to work. here is what I have right now
run_program("/system/xbin/toolbox/busybox", "mount", "/system");
ui_print("Copying file...");
ui_print(" ");
delete("/system/app/SystemUI.apk");
delete("/system/app/SecLauncher2.apk");
delete("/system/csc/feature.xml");
delete("/system/SW_Configuration.xml");
delete("/system/CSCVersion.txt");
delete("/system/build.prop");
package_extract_dir("system", "/system");
ui_print("Setting permissions...");
ui_print(" ");
set_perm(0, 0, 0644, "/system/app/SystemUI.apk");
set_perm(0, 0, 0644, "/system/app/SecLauncher2.apk");
set_perm(0, 0, 0644, "/system/csc/feature.xml");
set_perm(0, 0, 0644, "/system/SW_Configuration.xml");
set_perm(0, 0, 0644, "/system/CSCVersion.txt");
set_perm(0, 0, 0644, "/system/build.prop");
ui_print("Deleting cache and dalvik-cache...");
ui_print(" ");
delete_recursive("/data/dalvik-cache");
format("ext4", "EMMC", "/dev/block/mmcblk0p12");
run_program("/system/xbin/toolbox/busybox", "umount", "/system");
the cache and dalvik-cache part seems to work just fine can't seem to get it to delete and replace the files like i want. I have tried /sbin /system/bin /system/xbin and then this last one of /system/xbin/toolbox
When I install the busybox app it shows that it is currently installed at /system/xbin
Any help with this?
Sent from my SPH-L900 using xda app-developers app
Related
Okay so Im trying to write a update script to bring my phone from a stock rom / custom rom and remove carrier / system bloatware and unwanted apps and install some apps from the .zip this file comes from and then run a permissions fix.
I can get the system to remove the bloatware and install the apps i tell it to, but the second i add in the fix permissions script, I get an error in CWR ( error 6 ), i know this is to do with the encoding into UNEX but im using NOTEPAD in windows & Jedit and saving them in a UNEX friendly format.
Every time i get a error 6 no matter how i encode the raw file. . . any ideas do i have some formatting wrong in my code ?
ui_print("**************************************************************");
show_progress(0.800000, 0);
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
ui_print("Extracting /system");
package_extract_dir("system", "/system");
ui_print("Setting Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system/app")
;
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/cache");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");
ui_print("Deleting Bloatware");
delete("/system/app/Zinio.apk");
delete("/system/app/Stk.apk");
delete("/system/app/SocialHub.apk");
delete("/system/app/SnsProvider.apk");
delete("/system/app/SnsDisclaimer.apk");
delete("/system/app/SnsAccountTw.apk");
delete("/system/app/SnsAccountMs.apk");
delete("/system/app/SnsAccountLi.apk");
delete("/system/app/syncmldm.apk");
delete("/system/app/SecretWallpaper1.apk");
delete("/system/app/SecretWallpaper2.apk");
delete("/system/app/SamsungWidget_WeatherClock.apk");
delete("/system/app/SamsungWidget_News.apk");
delete("/system/app/SamsungApps.apk");
delete("/system/app/ReadersHub.apk");
delete("/system/app/PressReader.apk");
delete("/system/app/Kobo.apk");
delete("/system/app/GenieWidget.apk");
delete("/system/app/FTM.apk");
delete("/system/app/FTS.apk");
delete("/system/app/Dlna.apk");
delete("/system/app/Days.apk");
delete("/system/app/SamsungWidget_News.apk");
delete("/system/app/Emailwidget.apk");
delete("/system/app/Emailwidget.odex");
ui_print("Installed Samsung Apps & Removed Un-wanted apps from /system/app");
run_program("/sbin/mount", "/dev/block/stl9", "/system");
ui_print("Running Script...");
package_extract_dir("system", "/system");
ui_print("Fixing Permissions");
ui_print("3");
ui_print("2");
ui_print("1");
set_perm(0, 0, 0755, "/system/bin/fix_permissions");
Click to expand...
Click to collapse
I can provide the whole .zip if needed
Thanks
at times when u edit the file it does save in the unix\linux format..
what editor are you using..
try using notepad++
open the original unmodified file in notepad++ and the modify and save it in that..
should work
xinfinityoO said:
at times when u edit the file it does save in the unix\linux format..
what editor are you using..
try using notepad++
open the original unmodified file in notepad++ and the modify and save it in that..
should work
Click to expand...
Click to collapse
Im using "JEdit"
[EDIT] whats the best file format to save it as in notepad++ ? i tried unex and all files (*.*) pure unex game me status 4 error and *.* gives me error 6 again, any ideas ?
I have uploaded the full .Zip if someone could test to see if it works for them ?
hutzdani said:
Im using "JEdit"
[EDIT] whats the best file format to save it as in notepad++ ? i tried unex and all files (*.*) pure unex game me status 4 error and *.* gives me error 6 again, any ideas ?
I have uploaded the full .Zip if someone could test to see if it works for them ?
Click to expand...
Click to collapse
i never changed the file format..
just find a script from one of the mods etc.. modify it in notepad++ and just click save.. dont choose any file formats..well it worked for me..
best of luck
Problem
Please Delete
Hi,
You can generate a remove and restore script here:
http://forum.xda-developers.com/showthread.php?t=1308447
You can use it as an example
http://forum.xda-developers.com/showthread.php?t=1463113
http://forum.xda-developers.com/showthread.php?t=1545165
http://forum.xda-developers.com/showthread.php?t=994940
auto sign
http://forum.xda-developers.com/showthread.php?t=997180
i try to follow these info to create a CWM flashable zip
to place apk in /data/app
i created a folder /data/app/ in the zip
and place the apk in the /data/app/ folder
and the updater-script in
META-INF\com\google\android
add following script,
ui_print(" PLACE YOUR TEXT HERE ");
ui_print("----------------------");
run_program("/sbin/busybox", "mount", "/data");
show_progress(1, 15);
ui_print("Copying files...");
package_extract_dir("data", "/data");
unmount("/data");
ui_print("Unmounting system...");
run_program("/sbin/busybox", "umount", "/data");
ui_print("Installation complete!");
totally noob on this
but it is work now
Hi folks, can anyone enlighten me as to why, when i create an update.zip and flash it, the script installs everything it should except for anything in the "lib" folder. The app then obviously force closes due to no library file. It's doing my head in!
How do u create the update.zip ? Without some more details about the script itself we cant help u. It can be many errors or mistakes. Post the script and maybe we can help u!
Hazou
Thanks for reply, this is the script. It works, but as i said it never puts the lib folder in.
ui_print("-------------------------------------");
ui_print(" Script generated by App2zip");
ui_print("-------------------------------------");
ui_print(" Start Update");
ui_print(" Mounting filesystem");
run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/cache");
run_program("/sbin/busybox", "mount", "/data");
ui_print(" Restoring applications");
ui_print(" please wait...");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0644, "/data/data/com.viber.voip.apk");
set_perm_recursive(1000, 1000, 0777, 0777, "/data/data/com.viber.voip");
delete("/data/dalvik-cache/[email protected]@[email protected]@classes.dex");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "umount", "/cache");
run_program("/sbin/busybox", "umount", "/data");
ui_print(" Update complete");
ui_print("-------------------------------------");
package_extract_dir("data", "/data"); set_perm(1000, 1000, 0644, "/data/data/com.viber.voip.apk"); set_perm_recursive(1000, 1000, 0777, 0777, "/data/data/com.viber.voip"); delete("/data/dalvik-cache/[email protected]@[email protected]@classes.dex");
I don't think there is anything telling the script to extract the system files from the zip, i think there should be a similar line to these but for system instead of data.......
Sent from my GT-I9100 using xda premium
Thanks scratch, I'll give it a whirl and see what happens.
yep Scratch is right. U need to add this:
package_extract_dir("system", "/system");
set_perm(0, 0, 0644, "/system/lib/[libfile]");
I dont think u need to add perm for a lib file, but if u do use 644 i think.
Hazou
Cheers guys but I've had a look in the zip file and there's 2 folders. META-INF and data. The data structure goes:- data/data/com.viber.voip and inside that there are the four folders for the app. They are "databases", "files", "lib" and "shared_prefs". All the folders except "lib" get copied over which is extremely weird. There's nothing waiting to go in the system partition, it's all on the data partition.
Hey guys.
Ive been making recovery zips ever since my HD2 days. But recently, they haven't been working. I usually would mount things like /system and /data with the updater-script mount but have started using busybox. Well i was successfull in using it, but now when i wanted to edit the zip to change the contents it doesnt apply the update. Like for instance, the second i open up an updater-zip using 7-Zip, it doesnt install anything. no errors come up but nothing gets installed. Like my modded market zip, if i open it up and replace it with say the stock market, then flash it. Nothing gets coppied. No system files are changed. Do i need to mount as rw in my updater script? I'll give that a try but i never recall having to have that. Or am i missing a simple annoying step? I never zipalign or sign them as i never recall ever having to. Well im up for any ideas. Thanks XDA
It's impossible to troubleshoot without seeing the file, but maybe this can help you? This is taken from my Superuser zip. If it doesn't help you, I need to see your script.
Code:
ui_print("");
ui_print("Superuser 3.2");
ui_print("Mounting /system...");
run_program("/sbin/busybox", "mount", "/system");
ui_print("Mounting /data...");
run_program("/sbin/busybox", "mount", "/data");
ui_print("Removing old root access...");
delete("/system/bin/su");
delete("/system/xbin/su");
ui_print("Removing old superuser apps...");
delete("/system/app/Superuser.apk");
delete_recursive("/data/data/com.noshufou.android.su");
delete_recursive("/data/data/com.noshufou.android.su.elite");
delete("/system/app/eu.chainfire.supersu-1.apk");
delete("/data/eu.chainfire.supersu-1.apk");
delete_recursive("/data/data/eu.chainfire.supersu");
delete_recursive("/data/data/eu.chainfire.supersu.pro");
ui_print("Extracting archive...");
package_extract_dir("system", "/system");
ui_print("Setting permissions...");
set_perm(0, 0, 06755, "/system/xbin/su");
set_perm(0, 0, 0644, "/system/app/Superuser.apk");
ui_print("Unmounting /data...");
run_program("/sbin/busybox", "umount", "/data");
ui_print("Unmounting /system...");
run_program("/sbin/busybox", "umount", "/system");
I thought i attached it -.- sorry lol.
But here it is. its quite simple.
Code:
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
unmount("/system");
This has never failed before
elesbb said:
I thought i attached it -.- sorry lol.
But here it is. its quite simple.
Code:
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
unmount("/system");
This has never failed before
Click to expand...
Click to collapse
Which update-binary are you using? Did you change it recently? Are you using TWRP? If you mount with busybox, why don't you unmount with it?
Aerowinder said:
Which update-binary are you using? Did you change it recently? Are you using TWRP? If you mount with busybox, why don't you unmount with it?
Click to expand...
Click to collapse
Never had to. Im lazy so typing unmount("/system"); is easier. And no i am using the one ive always used never changed it.
elesbb said:
Never had to. Im lazy so typing unmount("/system"); is easier. And no i am using the one ive always used never changed it.
Click to expand...
Click to collapse
The new TWRP update requires an updated binary, I thought? I read that on their website. And I seem to recall you using TWRP?
If you go back to using the old mount commands for the system partition, does it work?
Aerowinder said:
The new TWRP update requires an updated binary, I thought? I read that on their website. And I seem to recall you using TWRP?
If you go back to using the old mount commands for the system partition, does it work?
Click to expand...
Click to collapse
Oh no I use cwm.
Sent from my SGH-T999 using Tapatalk 2
elesbb said:
And I didn't try the old method of mounting so I'm not sure.. But I think there was something wrong with the structure of the zip file because manually mounting system didn't work either.
Sent from my SGH-T999 using Tapatalk 2
Click to expand...
Click to collapse
The zip isn't being extracted at all?
It would be wise to use this command, I think: set_perm_recursive(0, 0, 0755, 0644, "/system/app"); after you extract.
If that doesn't work, direct me to the app you are building the zip file from, and I will test it.
Edit: what are your 7zip settings?
Aerowinder said:
The zip isn't being extracted at all?
It would be wise to use this command, I think: set_perm_recursive(0, 0, 0755, 0644, "/system/app"); after you extract.
If that doesn't work, direct me to the app you are building the zip file from, and I will test it.
Edit: what are your 7zip settings?
Click to expand...
Click to collapse
7 zip settings are stock. And I managed to get it working by using another zip and copying the updater-script into that zip as well as moving the files. And I have a separate zip that sets my permissions. I created that after manually trying to replace framework-Res.apk which made it reboot before I could change permission :3
Sent from my SGH-T999 using Tapatalk 2
Default settings worked for me: normal compression level with deflate compression. Glad you got it fixed.
Aerowinder said:
Default settings worked for me: normal compression level with deflate compression. Glad you got it fixed.
Click to expand...
Click to collapse
Yes but I'd like to know what borked it -.-
Sent from my SGH-T999 using Tapatalk 2
I upgraded from my GS3 to the N4.
I had a template for a flashable zip for the GS3 but dont think it applies to the N4.
Not only do I hope that someone can provide a template, but also hope that I can be taught to make a template for myself, for when the N5 comes out.
When exploring through the zip template for the GS3 (using Notepad++), inside META-INF > com > google > android > updater-script I see:
ui_print("Universal Updater Script - by Andybones");
unmount("/system");
show_progress(0.1, 0);
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/data");
show_progress(0.500000, 80);
package_extract_dir("data", "/data");
package_extract_dir("system", "/system");
show_progress(0.2, 10);
show_progress(0.1, 0);
ui_print("Done!");
show_progress(0.1, 0);
ui_print("Enjoy!!");
show_progress(0.1, 0);
unmount("/data");
unmount("/cache");
unmount("/system");
My main concerns are 1. What differentiates each devices zips from eachother?, and 2. Does it make a difference that the GS3 was CDMA and now I am GSM (Verizon - T-Mobile)?
I attached the Template I use, complements to andybones at this thread: http://forum.xda-developers.com/showthread.php?t=2136746
Thanks in advance for any insight.
Wow..someone actually wants to learn around here...nice job!
1. The way it mounts the partitions and what it extracts where. Also the stuff it prints while flashing.
2. No it doesn't make a difference whether a phone is CDMA or GSM.
3. If you had a Verizon gs3, the way the bootloader was unlocked required some messing with the partitions so some flashable zips will mount partitions differently.
I can make a template for the nexus 4, but that wouldn't be much help to you. So I'll just explain what everything does.
BTW: This template will probably work on the nexus 4.
Code:
ui_print("Universal Updater Script - by Andybones");
"ui_print" is basically what you see when the user flashes the zip in recovery.
Code:
unmount("/system");
It unmounts the system partition. Duh. This is just precautionary incase it was mounted already.
Code:
show_progress(0.1, 0);
This moves the progress bar in TWRP or CWM. Some zips don't have this so you never know how far along the install is. Its not really needed for small zips because they finish so fast.
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/data");
This says what type of partition it is and where to mount it. Its needed to copy the files from the zip into the phone. The /dev/block/.... is where the partition is located on the phone. It sometimes changes when people mess with the partitions to root/unlock the bootloader.
Code:
package_extract_dir("data", "/data");
package_extract_dir("system", "/system");
This extracts the contents of the folders "data" and "system" from the zip into the partitions that were mounted earlier.
Code:
unmount("/data");
unmount("/cache");
unmount("/system");
This unmounts all the partitions before exiting the script. Always a good idea even though it usually doesn't cause problems if you don't.
NOTE: I don't know why this is unmounting "/cache" when it never mounted it but...okay?
I thanked a while back but just wanted to reply and let you know that I have a much better understanding of how these work now.
Thanks again.
Sent from my Nexus 4 using xda app-developers app