yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] X7SHaDe:
Hmmm... Now that you've pointed the sed part out... I don't think that the functionality of the script will be changed if we remove the \(..*\) and \1... and I can't also remember for what purpose I placed those :eek:

Anyway, I'm happy that I was able to contribute here. I'm just thinking... Grep might catch a filepath that should not be used... For example, we want to extract the contents of a/b to /system/c , then for whatever reason, there could be a filepath inside the zip named not_the_right_folder/a/b... That will also be extracted to /system/c even though we only wanted the contents of a/b, because grep detected the pattern "a/b"

Maybe we should somehow anchor the start of $1? ($1 must always be the beginning to avoid the bug above) Btw, using grep -o with $ to anchor it to the end to simplify the code was a nice idea :D

PS.

I remember the \(..*\) and \1's purpose now, enlisting the contents of the zip also outputs the folders without the files, before the actual files of the folder (that's the case in my unzip binary, not sure for the others though). Running "unzip -l" on a zip that contains a folder named "my_folder" with cat, dog, and mouse file inside and another folder named "pics" with a, b, and c files will output something like this after our filters

With \(..*\), I will be able to filter out my_folder entry and we will be left with

But all of this is irrelevant now with the code you've written :silly:
[Android Software/Hacking General [Developers Only]] osm0sis:
The space I added to the beginning of the grep pattern anchors it to the beginning of the path to try to protect against the case you're describing, and combined with unzip also listing only the contents under the proper target with $1/* should avoid the problem entirely.

I mean you can make a filename contain any character with an escape like \| so nothing we do will be 100% bulletproof, but I think we've at least covered everything sane. :)
[Android Software/Hacking General [Developers Only]] X7SHaDe:
Oh I never saw that space :silly:

Goodwork :D
[Android Software/Hacking General [Developers Only]] osm0sis:
You too! Thanks for the help! I'm always open to improvements. :)
[Android Software/Hacking General [Developers Only]] Nikhil:
Hi [MENTION=4544860]osm0sis[/MENTION],

I need your help with executing a shell script within update-binary (which is also a shell script)

what i am trying here is

package_extract_file "afzc/afzc" "/tmp/afzc.sh"
chmod 755 /tmp/afzc.sh;
/tmp/afzc.sh "-ei" "/system/app/NovaLauncher/NovaLauncher.apk"

the file afzc.sh contains code to copy the "/system/app/NovaLauncher/NovaLauncher.apk" line and following is the how I am trying to do.

#!/bin/bash
OUTFD=/proc/self/fd/$2;

# embedded mode support
readlink /proc/$$/fd/$2 2>/dev/null | grep /tmp >/dev/null;
if [ "$?" -eq "0" ]; then
# rerouted to log file, so suppress recovery ui commands
OUTFD=/proc/self/fd/0;
# try to find the actual fd (pipe with parent updater likely started as 'update-binary 3 fd zipfile')
for FD in `ls /proc/$$/fd`; do
readlink /proc/$$/fd/$FD 2>/dev/null | grep pipe >/dev/null;
if [ "$?" -eq "0" ]; then
ps | grep " 3 $FD " | grep -v grep >/dev/null;
if [ "$?" -eq "0" ]; then
OUTFD=/proc/self/fd/$FD;
break;
fi;
fi;
done;
fi;

ui_print() {
until [ ! "$1" ]; do
echo -e "ui_print $1\nui_print" >> $OUTFD;
shift;
done;
}

ui_print "print something on ui"

case "$1" in
"-d")
ui_print "delete"
shift 1;
rm -rf "$@"
;;
"-ei")
ui_print "copying log"
shift 1;
echo "install=$@" >> addondbackupdata
;;
r)
echo "restoring"
;;
esac

Now, The chmod command is getting executed properly, meaning the file exists. However, I am still getting following error in logs.

/tmp/aroma/update-binary: line 285: /tmp/afzc.sh: not found

as I know, we can directly execute an executable file with its name, I am making it executable by adding #!/bin/bash at the start of the file and then doing a chmod 755 (am I missing anything to make it executable?)

please suggest, what should be done this case? I am executing it from aroma installer (attaching zip for reference). :)
[Android Software/Hacking General [Developers Only]] osm0sis:
Most likely a bad hashbang.

There is almost never bash enabled in busybox, especially not in recovery, and even when you find one it's just a redirect to either ash (default) or hush (also uncommon). sh is also just a redirect to one of these.

So I think your best bet is always #!/sbin/sh while in recovery. That should always exist.
[Android Software/Hacking General [Developers Only]] Nikhil:
Thanks mate for explaining and solving it.

You were right, the issue was in hash bang. Changing it worked. :)
[Android Software/Hacking General [Developers Only]] ale5000:
Sorry, I have missed that part.

Now I have another problem, in the process of signing there is zipadjust.

I'm under Windows.

Unfortunately zipadjust corrupt the updater-script file inside the zip and despite the file isn't used I don't feel good having a partially broken zip.

Is there a way to fix it?
[Android Software/Hacking General [Developers Only]] osm0sis:
Don't worry about zip testers. Chainfire designed zipadjust, as far as I know that's how it works; it intentionally partially "breaks" the zip to circumvent that "1 and 8" flags error and still pass signing.

To be clear, nothing should be corrupt and should all extract correctly, so if that's what you're experiencing then something went wrong.
[Android Software/Hacking General [Developers Only]] ale5000:
All the files extract correctly excluding "updater-script" that failed extraction.

Try to extract "updater-script" fail.
[Android Software/Hacking General [Developers Only]] TKruzze:
I've never been able to get zipadjust to work properly with JRE 8 installed (under Windows 7). I've always had to install JRE 7 to get zipadjust to work properly. I must admit, though, that it's been quite some time since I've tried to make it work.

EDIT :As [MENTION=4544860]osm0sis[/MENTION] correctly pointed out, it's the minsignapk.jar process that corrupts the zip for me under JRE 8. Works perfectly under JRE 7, though.
[Android Software/Hacking General [Developers Only]] ale5000:
I'm using the "exe" version on the second post (inside ZipScriptSign-Win32.zip) and it seems to work properly without any error but I have the "updater-script" file corrupted.

Is it related to JRE version?
[Android Software/Hacking General [Developers Only]] osm0sis:
He means MinSignApk.jar if I recall correctly from when we first experimented with all this, but I'm now also using JRE 8 and signing appears to work fine for me. Are you using my included batch files? I've automated it all so you only need to drag-and-drop.
[Android Software/Hacking General [Developers Only]] ale5000:
Yes, I'm using your batch file but I have also tried to execute the commands manually.

The problem happens exactly within zipadjust.

MinSignApk get the file already corrupted before starting.
[Android Software/Hacking General [Developers Only]] ale5000:
[MENTION=4544860]osm0sis[/MENTION]: The problem doesn't happen with all zips.

To reproduce the problem try to sign this zip.
[Android Software/Hacking General [Developers Only]] osm0sis:
Hmm right you are..

microG-unofficial-installer-ale5000-v1.0.19-pre-alpha3-debug-signed.zip: Checksum error in microG-unofficial-installer-ale5000-v1.0.19-pre-alpha3-debug-signed\META-INF\com\google\android\updater-script. The file is corrupt
microG-unofficial-installer-ale5000-v1.0.19-pre-alpha3-debug-signed.zip: The archive is corrupt

zipadjust is from [MENTION=631273]Chainfire[/MENTION]'s source, in his OpenDelta work for Omni. Perhaps he can shed some light on this and/or provide a fix.

(if he doesn't reply here you should follow up with him in the SuperSU thread where he'll more likely read his mentions)

Edit

: It's unclear why, but if you replace the updater-script with the one from my OP it all signs and works correctly. Perhaps something about the dummy updater-script pointlessly including a hashbang/shebang?

Edit 2

: Yup! Removing the #!/sbin/sh from your updater-script resolves the issue. :good:
[Android Software/Hacking General [Developers Only]] TKruzze:
In all my time of building PA and TK GApps, I would always install JRE 7 before building and then revert to JRE 8 when done. I never took the time to research why the zip file was corrupt when using JRE 8.

I spent 10 minutes today and found the issue I was having. The problem was in the updater-script file of all places. I think it was the <CR> I had at the end of the file. Once I removed that and made it Linux friendly, everything worked perfectly under JRE 8.

I also wrote a Windows Shell Extension (years ago) to make building easier. With a simple right-click on a folder, it'll automatically build a signed zip file. It also detects whether it's a shell script or edify script and process accordingly. I'll see if I can dig up the source code and make it more widely available.
[Android Software/Hacking General [Developers Only]] ale5000:
Now I have added a file named VERSION in the main folder and it corrupt this file.

Re-run the script cause the problem at the same file, so it seems it corrupt a file at a specific position of the zip (at least it seems so).

I hope [MENTION=631273]Chainfire[/MENTION] or someone else find the cause.
[Android Software/Hacking General [Developers Only]] osm0sis:
Use the updater-script from one of my zips, busybox for example.

There's a definite issue with zipadjust and updater-scripts, I can verify it when there's a shebang (#!/sbin/sh at least, probably all kinds), and think [MENTION=2777334]TKruzze[/MENTION] pretty much verified another way to trigger it with ^M (carriage returns), but I can't reproduce it as long as I'm using my updater-script.
[Android Software/Hacking General [Developers Only]] ale5000:
[MENTION=4544860]osm0sis[/MENTION]: This zip contain your updater-script, try to sign it.
[Android Software/Hacking General [Developers Only]] osm0sis:
I can reproduce it, but then replacing the one in that zip with the one directly from my Busybox zip removed the error for that file.. :confused:
[Android Software/Hacking General [Developers Only]] ale5000:
I have taken updater-script from your "UPDATE-Busybox.Installer.v1.26.2-ALL-signed".
[Android Software/Hacking General [Developers Only]] osm0sis:
Yes, I then re-added the your exact VERSION file to the zip myself and then signing worked perfectly. So, I guess you just found another way to trigger the issue, and it has something to do with your archiver, or archiving settings of choice.

The main difference I notice before and after I've re-added the offending files is that the packed sizes go up by 2 bytes. No idea why, that's something that you may have to bring up with [MENTION=631273]Chainfire[/MENTION] (most likely in his SuperSU thread to get his attention), but using a different archiver should fix things.
[Android Software/Hacking General [Developers Only]] daniel_m:
Can the update-binary (e.g. from an OTA) be executed in the terminal? I tried something simple like "./update-binary ui-print("test"), but that didn't work.

I'd like to use block_image_update to patch the mounted image of an original system partition. My plan is to extract the original and patched system image and see which files changed ... to manually patch my current, modified, system.
[Android Software/Hacking General [Developers Only]] osm0sis:
Yeah it'll run (my FlashAfterUpdate addon.d does this), but the syntax is only to supply a zip from which it'll read the script:

update-binary <RECOVERY_API_VERSION> <OUTFD> <ZIPFILE>

API is 3 for a long time now, FD is the active one for your recovery so you can see your zip's output.
[Android Software/Hacking General [Developers Only]] daniel_m:
Too bad. It would have been nice to be able to execute commands directly in the terminal, instead of having to make zip files and modify updater-script :)
[Android Software/Hacking General [Developers Only]] dlroids:
It's cool

TNX♥
[Android Software/Hacking General [Developers Only]] nathanchance:
[MENTION=4544860]osm0sis[/MENTION], thank you very much for the documentation regarding signing. I'm having a hell of a time getting it working though, as TWRP isn't verifying my signature.

Here's the bit of the recovery log:

I:operation_start: 'Flashing'
Installing zip file '/sdcard/Files/Zips/Flash-Angler-v2.2-signed.zip'
Checking for Digest file...
Digest matched for '/sdcard/Files/Zips/Flash-Angler-v2.2-signed.zip'.
Verifying zip signature...
I:read key e=3 hash=20
I:1 key(s) loaded from /res/keys
I:comment is 1639 bytes; signature 1621 bytes from end
I:failed to verify against RSA key 0
E:failed to verify whole-file signature
I:Zip signature verification failed: 1
Zip signature verification failed!
Error installing zip file '/sdcard/Files/Zips/Flash-Angler-v2.2-signed.zip'
Updating partition details...
I:Data backup size is 3113MB, free: 14905MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
...done
I:Set page: 'flash_done'
I:operation_end - status=1

Here's my commands in my script plus keys, which were generated through AOSP's make_key tool.

I don't get any errors while signing and the zip itself flashes fine without zip signature verification turned off. I tried generating keys the way in the other thread but it's still the same. Could it be something with the signing jars? They should be platform independent right?
[Android Software/Hacking General [Developers Only]] osm0sis:
TWRP won't verify anything that isn't signed with testkeys currently. Stick to the ones included by default with my ZipScriptSign package and it should work.
[Android Software/Hacking General [Developers Only]] nathanchance:
It would be something that simple, now I feel embarrassed :silly: thank you for the quick and gracious response as always!
[Android Software/Hacking General [Developers Only]] ale5000:
[MENTION=4544860]osm0sis[/MENTION]: I have discovered that if the zip file is created with "zip" instead of "7za" then it always work correctly also if you put a shebang in updater-script.

So zipadjust is incompatible with 7-zip zip archives.
[Android Software/Hacking General [Developers Only]] nathanchance:
To follow up on this, given I know what the root cause of the problem is, I was curious if I could add my own keys to TWRP. Turns out it's SUPER easy lol. You can follow Google's documentation and add your public key (.x509.pem file) to your own build of TWRP, like so: https://github.com/nathanchance/twr...mmit/23292616484e93bd7fcdbb097d0d851b383ba17a

Compile it up and then you can sign your zips with your own keys. Practical? Absolutely not. But it's nice for self builders I suppose.
[MDA III, XDA III, PDA2k, 9090 Software Upgrading] jdc:
New owner of a BA (O2 Xda IIs branded)

ROM:

Helmi BA WM2k5 AKU3.5 v1.4 Vanilla

Boot screen after a reset shows:

R: 1.15.00

G: 1337.45

D: 5.04.09.WWE

System Settings, About shows:

MW5 w/ the Messaging and Security Feature Pack

OS 5.1.195 (build 15698.3.5.0)

Applied patches:

BT Icon

Camera Patch

Flight Mode Patch

Applied registry changes:

Timezone and time update (doesn't seem to work)

I have looked all over the wiki and the forums trying to figure out if I have the latest versions of everything, and to say the least I'm confused.

I keep seeing references to the iMate BT stack upgrade, Helmi's BT Widcomm BT upgrade, the seven or more other BT upgrades on the FTP. My eyes are starting to cross. :-)

There is getting the audio (OS, media player, etc) to be redirected to the BT headset vs the device itself (can't figure this one out)

There is the Cyberon voice dialer vs MS VC 1.5/1.6. From what I can tell, VC 1.5 doesn't work, but 1.6 does, which I can't get to install, and either one is supposed to be better than the Cyberon dialer (which I did install).

And then there is the BT file sending and receiving stuff, which I can't seem to find anything on either.

Nor what is OK to install from the massive amount of tools and utilities on the FTP server...

The wiki doesn't really seem to cover this stuff in an order that I can figure out, so I'm posting for help.

(Yes, I did try to figure things out, but after I had to nuke, repave and resync my handheld after a bad Widcomm BT 1.0.0.3900 upgrade package install, I decided to ask).

Does anyone have any advice? If I can get enough of this info together, I'll be more than happy to update or add a page to the wiki.
[MDA III, XDA III, PDA2k, 9090 Software Upgrading] hardingt0110:
OK, pretty much all of your questions have been answered numerous times before in other threads - you just need to look beyond the most recent page.

How do you know about the common problems, but you still can't find the solutions? They are usually on the same threads!

A good way of doing this is by using the search tool on the main nav bar. As I am very nice;) , I have given you a few of the answers to your problems:

BT Send and Recieve - I use xplode's AKU 3.5, which has no bluetooth send function in File Explorer. I am not in the know about whether Helmi's ROM has this. If not, the best option is Resco's excellent File Explorer 2005 - I purchased it, and have never regretted it. It includes numerous improvements to the standard File Explorer, including sending and recieving files via Bluetooth.

This is my reccomendation on that one:cool:

BT Headsets - I do not own one of these, so can't help you here, but I have heard it frequently mentioned on the forum, so look around.

Voice diallers - To be honest, it depends on which one you like the best personally - both have most of the same features. I suggest you try M$ VC 1.6, then 1.5 and if either of them work, be thankful for what you have:rolleyes:

Tools on FTP - Due to a high number of viruses on their recently, I suggest you stear away unless you have a reason (which you don't seem to) and you know what you are doing.

BT Stacks - These are separate software - they are not different versions. I suggest you use MS stack, as it has the most support from other sofware - widdcom is oftem not supported. And I suggest you stop fretting about whether you have the latest version! You don't have any reason to want it!

This is all I can help you with.

If any of this is not accurate, I'm sorry, but I'm only trying to help. I don't know everything there is to know YET:)
[MDA III, XDA III, PDA2k, 9090 Software Upgrading] jdc:
I have, and the answers are either for older versions of the ROM, or refer to having something on the device (say, the BT stack) be a certain version, which I can't figure out which one I have.

Here's as example: Trying to find out how to find which BT stack I have and the version/build. Hit the advanced forum search, limit the search to just the BA forums, search for "find bluetooth build", get 30 threads, many of which have over 200+ posts, many of which are a year or more old.

Searching for "switch, widcomm, microsoft, stack, wm5" brings up two threads, one which say don't do the tutorial listed on another site, it will brick the phone, and the other is discussing another cooked ROM and doesn't say anything about switching the stack.

Then there are things like this post about removing the 3 second ring delay and making sure the ringer is really loud (http://xdaforums.com/showthread.php?t=258109). I ran across that one doing the above listed search. No where in the wiki that I saw under the BA pages was that listed.

Yes, I am quite familiar with the search function.

While I do appreciate your effort, I'm afraid that none of my questions were answered.

BT send/receive, you say you don't know about Helmi's ROM as you don't use it, then recommend another piece of software (which I will look into, thanks)

Audio over the BT headset, you say you don't have one so you can't help.

Voice dialer, you suggest to try the MS ones, which I have said I have yet to find anything that states it will work on the ROM I have installed, much less where to find it.

FTP server virus scare. Eh, I'm not worried. I've very careful with unknown files and have AV and firewall software on the machine I run active sync on. :-)

BT Stacks: There are different builds/versions out there from Widcomm, and I can't find anything on the MS stack. And yes I am going to worry about the different versions as there are reports of the various builds having better or worse performance and features.

I'm still confused on a lot of things. I'm trying to organize what I do find, but as I keep finding conflicting information, I'm getting no where.

I di thank you for the reply tho, and the pointer to the program. I still want to know about the ROM that is on my device tho. :-)
[MDA III, XDA III, PDA2k, 9090 Software Upgrading] rhmartin:
jdc,

you got one of the best & the latest wm5 BA roms around. the choices anyway are xplode's aku 3.5, helmi's aku3.5 rom kitchen (similar to the vanilla version) & helmi/logout ROM.

if you want to add the latest additional programs, go download one of the earlier aku 3.5 v1.4 rom (non-vanilla) of helmi or xplode's aku 3.3 rom and extract the extended rom, add the dir to your storage card & reflash.

stop looking for newer versions at the ftp, all the threads of helmi & xplode are informative & comprehensive enough to answer your querries or provide you with the programs you may need. do check out the earlier aku3.3 threads of both so you can have an idea of what you are getting from the latest aku3.5roms. most if not all the progs you need are all there.

most of the confusion you have is because you strayed away from the thread you got the rom from. like the ms bt stack which is built-in in all the roms above, if you don't have problems with it then stick with it. if you read through the widcomm bt stack thread of helmi you will find out why some PREFER it. stress on that word because eventually it's your decision, like me i use ms bt because it serves my purpose well - i don't need to stream music to bt stereo headset, or transfer files using bt.

ms voice command v1.6 also works well in the roms. check out your version & file.

if you have any problem with other things, checkout the thread first before posting your problem & when you do post include all the info on your problem: i.e. bt reception problem using ms bt stack & hb200 in helmi aku3.x rom.

the ftp is a mix compilation of test files, new releases, & some very specific to a rom version. if you want to d/l something make sure it's from the directory of the rom ou have - ie.: helmi_c or xplode. stray from it at your own risk.

don't expect too much from wiki either, although the forum is moderated there are so much information to gather & compile to be as comprehensive for newbies. stick to the threads i've mentioned above, they are as good as the wiki. besides, xda-dev is not the iMate or Qtek or O2 forum where support is expected for the roms they publish. most of members here are enthusiast & sharing precious time & skills for free & for fun. (xda)-DEVELOPERS not users, although most users have benefited from it.

please don't get me wrong & get offended, i'm sparing you the bashing which others might give you for your post. oh i forgot, i'm a BA newbie too. "i've read all over", tried the roms, DECIDED to stick with it, and live with it & all the limitations this aku 3.5 brings (like smart dialing).

cheers!