The latest version of Google Now (2.1) doesn't like being flashed. If you flash it via CWM it seems to break voice search functionality, causing a force close.
Playing with the adb shell, I discovered that the pm install command works nicely:
Code:
pm install [APKNAME].apk
So, I thought this would be perfect to execute in a shell script via CWM/Edify.
So far I've tried all manner of commands. First I was trying the above command in a install.sh file, before I realised that "pm" wasn't present anywhere in /sbin/ (the header of my shell script is #!/sbin/sh").
So, I've tried this:
Code:
#!/sbin/sh
exec /system/bin/pm install data/media/install/Velvet.apk
Here is the update script:
Code:
ui_print("Mounting system...");
run_program("/sbin/busybox", "mount", "/system");
ui_print("Mounting data...");
run_program("/sbin/busybox", "mount", "/data");
ui_print("Copying files...");
package_extract_dir("ultima/install", "/data/media/install");
package_extract_file("ultima/install.sh", "/tmp/install.sh");
ui_print("Setting perms...");
set_perm(0, 0, 0777, "/tmp/install.sh");
ui_print("Running install...");
run_program("/tmp/install.sh");
ui_print("Done...");
ui_print("Unmounting system...");
unmount("/system");
unmount("/data");
Which, copies the files correctly. This also isn't my first time running scripts in my installer, but this is the first time I've attempted this.
To no avail. This same command works in the adb shell, though.
Is there something I'm missing? Is this even possible?
Also, is there another way of flashing that may work? I heard about putting the original file ("Velvet.apk") in /system/app and then putting the updated version in /data/appcom.google.andorid.googlequicksearch-1.apk but this doesn't work either.
EDIT:
Hmm, running the above script in Busybox installer's script running function also works perfectly.
The only thing it won't do is install from CWM.
I've tried including the pm binary and a few other things
Bump
Related
I'm planning on using the UpdatezipCreator from this thread http://forum.xda-developers.com/show....php?t=1274736 to build an update script for some APK updates I want to package up. It appears this app has the ability to build a update-binary file for you.
I have APK files in both the system/app and data/app that I want to be copied to my phone. I'm confused on a few things.
First thing, can I have multiple destinations for the files in the script? I haven't found any examples with two destinations and there doesn't seem to be a spot to configure the source which makes me think it just takes everything in the zip and puts it in the folder you specifiy in the package_extract_dir function and that adding a second "package_extract_dir" function would confuse it.
The second question is I keep running across scripts that us busybox instead of the built in commands. Why would you need to/want to do that?
This is what I would think would work for my script:
Code:
ui_print("Preparing to update");
ui_print("Copying files..");
package_extract_dir("system", "/system");
package_extract_dir("data", "/data");
ui_print("Done! You can reboot your system now!");
I know I need a mount command before the package_extraction but I don't know which I should use and if I need a second mount for the /data/app folder as well.
"run_program("/sbin/busybox", "mount", "/system");"
or
"mount("/dev/block/stl6", "system", "/system", "rw");"
The folder structure of my zip is;
Zip
/system/app/apk files
/data/app/apk files
/META-INF
Do this in your updater-script:
Code:
run_program("/sbin/busybox", "mount", "/data");
run_program("/sbin/busybox", "mount", "/system");
ui_print("Preparing to update");
ui_print("Copying files..");
package_extract_dir("system", "/system");
package_extract_dir("data", "/data");
run_program("/sbin/busybox", "umount", "/data");
run_program("/sbin/busybox", "umount", "/system");
ui_print("Done! You can reboot your system now!");
I decided to give this a try.
Its a very simple flash and I guess an easy beginner task.
All I'm doing is adding S_opener.ogg to the notifications directory.
It's not in FJs AOSP rom and I just want to flash it after flashing his updates.
I found a tool that makes creating the zip pretty easy AFAIK
http://forum.xda-developers.com/showthread.php?t=1248486
I want to mount the system, copy the file, unmount.
The default script is below.
I have three questions before I create and flash this....don't wanna brick it
1)What's our mount point?
2)On the extract directory, can I use the parent like it is or do I have to specify by drilling down? (/system/media/audio/notifications)
3)Does it unmount? Is that part of the extract command?
THANKS!
Here's the script:
ui_print("Preparing to update");
# mounting system as r/w - ATTENTION - set the the mount point
# to the proper for your device! Example mountr command is
# mounting system for Samsung GT-I5800 aka Galaxy 3
mount("/dev/block/stl6", "system", "/system", "rw");
ui_print("Copying....");
# copy system content to the system directory on your device
package_extract_dir("system", "/system");
ui_print("Done! You can reboot your system now!");
Cool project. Good luck.
Yea. I thought it would be a cool way to get a better idea of what it takes for these developers.
Any developers able to lend me a hand here?
I think my questions are clear....
I'd appreciate it.
Thanks!
Why not team up with Jessooca. She wants to learn too. Plus I think she will get more attention than you.
1) I find it easiest to use the "busybox" mount
-- this will always be compatible with just about any custom ROM. (no need to know the mount partition)
2) Yes, just use the parent directory
3) No, it doesn't unmount automatically (not that it really needs to anyway)
If copying system apps, you can also save some time by wiping dalvik-cache and rebooting right here in the script.
Here is a generic script good for just about anything you might want to throw into system/
Code:
ui_print("Updating System...");
show_progress(0.1, 0);
ui_print(" ");
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
run_program("/sbin/busybox", "umount", "/system");
ui_print(" ");
ui_print("Wiping Cache & Rebooting...");
run_program("/sbin/busybox", "mount", "/data");
delete_recursive("/data/dalvik-cache");
run_program("/sbin/busybox", "umount", "/data");
run_program("/sbin/reboot");
Hope this is helpful for you
Thanks! I found busy box in xbin. I also looked at fjs rom script and that's what he uses. I'll give it a shot
Sent from my SAMSUNG-SGH-I717 using xda premium
Bummer. I feel like I'm so close...
I have flashed three times and luckily no side effects but the file isn't there....
sbin doesn't have busybox in it but system/xbin does
So I did this:
Code:
ui_print("Preparing to update");
ui_print("Updating System...");
show_progress(0.1, 0);
ui_print("Coying Opener Notification");
run_program("/system/xbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
run_program("/system/xbin/busybox", "umount", "/system");
ui_print(" ");
ui_print("Done! You can reboot your system now!");
And that doesn't work either...
The cool thing is that I'm learning quite a bit with all these failures
That's why I chose a 'simple' task
Tried this to but it didn't work.
It flashed and said it went but the file isn't there....
Guess I'll try again tomorrow.
Code:
ui_print("Preparing to update");
ui_print("Updating System...");
show_progress(0.1, 0);
mount("/dev/block/mmcblk0p24", "system", "/system");
ui_print("Copying files Opener Notification");
package_extract_dir("system", "/system");
unmount("/system");
ui_print("Done! You can reboot your system now!");
You see /system/xbin/busybox while booted normally; however
when booted in recovery it sees /sbin -- trust me on this.
If you still want to use standard partition mounting try this:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/system");
Thanks for your help on this. I'll try sbin today. I trust ya
I did try that string but it threw an error and said I had four variables and it only wanted three.
Sent from my SAMSUNG-SGH-I717 using xda premium
hmm yeah well I just plucked that one out of a ROM installer
the /sbin/busybox mount has worked well for me over lots of zip and lots of different ROMs
Yep, that did it! Thanks
My first successful zip
Now to figure out how to make that the default notification.
It looks like it's in the build.prop but I haven't searched enough on xda yet.
I found the default notification for the ROM in build.prop but can't find where the current default notification is.
Is that in a file similar to build.prop?
Whenever I try flash a new nightly, my custom sounds go away. So, I created an update file with the ringtones, and some notification sounds. But every time I try to install the file, I get a error 0 in CWM. Here is my script file, what am I doing wrong. I use Notepad++ for editing the file. Any help is appreciated. Thanks.
ui_print("............................");
ui_print("............................");
ui_print("Mounting system...");
run_program("/sbin/busybox", "mount", "/system");
ui_print("Copying files...");
package_extract_dir("system", "/system");
ui_print("Unmounting system...");
run_program("/sbin/busybox", "umount", "/system");
ui_print("Installation done!.........");
prabs99 said:
Whenever I try flash a new nightly, my custom sounds go away. So, I created an update file with the ringtones, and some notification sounds. But every time I try to install the file, I get a error 0 in CWM. Here is my script file, what am I doing wrong. I use Notepad++ for editing the file. Any help is appreciated. Thanks.
ui_print("............................");
ui_print("............................");
ui_print("Mounting system...");
run_program("/sbin/busybox", "mount", "/system");
ui_print("Copying files...");
package_extract_dir("system", "/system");
ui_print("Unmounting system...");
run_program("/sbin/busybox", "umount", "/system");
ui_print("Installation done!.........");
Click to expand...
Click to collapse
Usually a status 0 error refers an incompatible update-binary in the zip file. I would recommend replacing it with a compatible one (Can be pulled from a ROM or other flashable zip that you know will flash successfully), then re-signing the zip file, will usually fix this error.
Sent from my SCH-I535 using xda premium
I pulled the update-binary from the cm 10.1.2 nightly. I know it works, because I can flash it, but the update file I created does not work.
shimp208 said:
Usually a status 0 error refers an incompatible update-binary in the zip file. I would recommend replacing it with a compatible one (Can be pulled from a ROM or other flashable zip that you know will flash successfully), then re-signing the zip file, will usually fix this error.
Sent from my SCH-I535 using xda premium
Click to expand...
Click to collapse
prabs99 said:
I pulled the update-binary from the cm 10.1.2 nightly. I know it works, because I can flash it, but the update file I created does not work.
Click to expand...
Click to collapse
Interesting, do you have the correct folder structure for the flashable such as META-INF->com->android and google folder->google folder->android->update-binary and updater script? Also do you have the correct folder structure for the ringtones and sounds? If you have named the .zip file update.zip try renaming it to something else (For example ringtonessounds.zip). Finally not that this should make a difference by try replacing:
Code:
run_program("/sbin/busybox", "umount", "/system");
With:
Code:
unmount("/system");
Is busybox installed in your device since you use busybox commands in your updater-script?
Also try to sign your zip file,, download signapk and run this command:
Code:
java -Xmx512M -jar signapk.jar -w testkey.x509.pem testkey.pk8 <Your zip file> <Your result zip file>
ensure you have installed java environment,,
..
shimp208 said:
Interesting, do you have the correct folder structure for the flashable such as META-INF->com->android and google folder->google folder->android->update-binary and updater script? Also do you have the correct folder structure for the ringtones and sounds? If you have named the .zip file update.zip try renaming it to something else (For example ringtonessounds.zip). Finally not that this should make a difference by try replacing:
Code:
run_program("/sbin/busybox", "umount", "/system");
With:
Code:
unmount("/system");
Click to expand...
Click to collapse
It was my directory structure that was bad. Thanks for your help.
Sent from my Galaxy Nexus using xda app-developers app
majdinj said:
Is busybox installed in your device since you use busybox commands in your updater-script?
Also try to sign your zip file,, download signapk and run this command:
Code:
java -Xmx512M -jar signapk.jar -w testkey.x509.pem testkey.pk8 <Your zip file> <Your result zip file>
ensure you have installed java environment,,
..
Click to expand...
Click to collapse
Have busybox installed. I am signing the zip with the test key. I don't have a private key.
Sent from my Galaxy Nexus using xda app-developers app
I want to change the screen resolution of my device and I have an sh script for it.
Code:
#!/system/bin/sh
am display-size 1280x800
am display-density 160
How do I create a flashable zip file that can execute this script?
supersapien said:
I want to change the screen resolution of my device and I have an sh script for it.
Code:
#!/system/bin/sh
am display-size 1280x800
am display-density 160
How do I create a flashable zip file that can execute this script?
Click to expand...
Click to collapse
It will be something like this:
Code:
# u have to get your mount point this is just example
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
package_extract_file("xxx.sh", "/tmp/xxx.sh");
set_perm(0, 0, 0777, "/tmp/xxx.sh");
run_program("/tmp/xxx.sh");
delete("/tmp/xxx.sh");
unmount("/system");
s3icc0 said:
It will be something like this:
Code:
# u have to get your mount point this is just example
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
package_extract_file("xxx.sh", "/tmp/xxx.sh");
set_perm(0, 0, 0777, "/tmp/xxx.sh");
run_program("/tmp/xxx.sh");
delete("/tmp/xxx.sh");
unmount("/system");
Click to expand...
Click to collapse
Thanks a lot. I came up with something similar but I missed the set_perm option.
Hi everyone.
I have a TWRP backup of Boot, System, and Data that I need to restore to a number of SM-T580 devices.
Typically TWRP requires backup paths to be in the format TWRP/BACKUPS/[android_id]/[whatever], but I have found that if you use the the CLI, you can get generalize the android_id part. IE: something like this works fine from the TWRP terminal:
Code:
twrp restore /sdcard/TWRP/BACKUPS/x/y
Having gotten this far, I'd like to see if I could make this a little easier to run for other members of my team. I've found a number of guides on creating Flashable Zip's which contain scripts in them that could themselves call upon shell scripts, so this looks like it may be the easiest way for my team to run the restore without having to use the terminal or know the android_id of any of the devices.
I borrowed my META-INF\com\google\android\update-binary from this Ultra Lean Rom, and my updater-script looks like this:
Code:
package_extract_dir("META-INF/tmp", "/tmp");
set_perm(0, 0, 0777, "/tmp/restore.sh");
run_program("/tmp/restore.sh");
META-INF/tmp/restore.sh looks like this:
Code:
#!/sbin/sh
/sbin/twrp restore /sdcard/TWRP/BACKUPS/x/y
When I put this on the device and try to run in through the Install process though, it will just sit there trying to "install" indefinitely. The restore.sh does get extracted into /tmp though, and if you run /tmp/restore.sh from the terminal the restore works great, but it just hangs from the Install process.
I have also tried the following lines in place of the above run_program line:
Code:
run_program("/sbin/busybox", "sh", "-c '/sbin/twrp restore /sdcard/TWRP/BACKUPS/x/y'");
run_program("/sbin/busybox", "sh", "/sdcard/restore.sh");
run_program("/sbin/sh -c '/sbin/twrp restore /sdcard/TWRP/BACKUPS/x/y'");
run_program("/sbin/busybox", "sh", "-c 'twrp restore /sdcard/TWRP/BACKUPS/x/y'");
run_program("/sbin/busybox", "sh", "-c", "'", "twrp", "restore", "/sdcard/TWRP/BACKUPS/x/y", "'");
run_program("/sbin/sh", "-c", "'", "twrp", "restore", "/sdcard/TWRP/BACKUPS/x/y", "'");
run_program("/sbin/sh -c 'twrp restore /sdcard/TWRP/BACKUPS/x/y'");
run_program("/sbin/sh", "-c 'twrp restore /sdcard/TWRP/BACKUPS/x/y'");
run_program("/sdcard/restore.sh");
run_program("/sbin/busybox", "sh", "/sdcard/restore.sh");
run_program("/sbin/sh", "/sdcard/restore.sh");
run_program("/sbin/sh", "twrp", "restore", "/sdcard/TWRP/BACKUPS/x/y");
In those cases I had manually put restore.sh in /sdcard/ and chmod'd it ahead of time. I'd also tried all of the above with restore.sh being extracted to /tmp but didn't paste for the sake of redundancy.
I have also tried switching out the top line to "#!/sbin/busybox sh" and "/sbin/twrp" to just "twrp" in recovery.sh, and pretty much every possible combination of all of the above, but only ever getting it the install process to either hang indefinitely or in some cases finish immediately with no errors (but no restore either).
I know this is probably a bit of a longshot as it's probably a niche need, but if anyone has any thoughts on this I'd appreciate it. Thank you in advance for your feedback.