You are here

You can have UPX and autoupdate (in theory at least).

10 posts / 0 new
Last post
Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
You can have UPX and autoupdate (in theory at least).

It's possible. I'm working on a way to fully automate the process (I just need some good docs on the batch language). I have a semi-automatic batch file already.

The problem is actually that UPX can't compress and decompress to produce the exact same file with W32 binaries (however, once a file is compressed and decompressed, the resulting file can be compressed and decompressed to produce that exact file), and that the small autoupdate difference file can't be applied to the modified files.
So here's how it works:
All of Fx's binary files are copied to a separate directory. The original files in the FxP directory are compressed and then decompressed. A program called xdelta will produce the differences between the original files (in the separate directory) and the files that are produced by being UPXed and unUPXed. Then the original files are deleted, the files in your FxP directory are reUPXed, and (optionally) the xdelta files are archived. To get the files back to the originals that will work with autoupdate, the UPXed files are uncompressed, and the xdelta files are used to patch them. This would work for Thunderbird too.

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2006-11-18 10:26
What's the point of all of

What's the point of all of that? You never say. To UPX the Firefox binaries to save space?

BTW: xdelta.org doesn't exist. I think you meant this one which is the one I used to use for Windows:

http://evanjones.ca/software/xdelta-win32.html

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
xdelta.org

http://xdelta.org works and has the newest version. http://www.xdelta.org does not work for some reason. The link you provided has a dated version. I've updated the link in the OP.

And yes, this is for people who don't have much free space on their flash drives so that they can use UPX without having to download a full update or carry a full backup (which defeats the purpose).

Vintage!

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 28 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Doesn't Matter

We're not allowed to alter them.

Sometimes, the impossible can become possible, if you're awesome!

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
You're not allowed to.

You're not allowed to. That's why I'm working on a batch file instead of suggesting that you add this to the launcher or something like that. It's for end users who wish to UPX the binaries and be able to autoupdate on-the-spot without backups.

Vintage!

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
I tried it with 2.0.0.7, and

I tried it with 2.0.0.7, and it failed to update to 2.0.0.8 with a partial update. I need to double check checksums and verify that xdelta is applying the patches correctly. I will also have a batch file ready for the entire process, including having checksums shown at each step soon. However, since I have limited knowledge of the batch language, and because xdelta can only do one file at a time (AFAIK), the batch file will only be able to process one file at a time. The goal is to automate the entire process (for all files at once), have errors/warnings/messages, the option to archive the xdelta files, ability to specify options for each program (UPX, Jacksum, xdelta, and 7-zip), and a test mode.

Vintage!

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
Forgot the -d switch.

I feel silly now. After much trial, error, and frustration, I finally got it to work.
Anyway, the batch files can be found here:
http://www.digital-signal.net/bahamut/batch/UPXAU/testing

Instructions:

  • Usage: [batch file] [file to prepare]
  • I will add echo messages in a later release.
  • As I stated before, only one file can be processed at a time.
  • I do not have error-catching mechanisms implemented yet. You may seriously screw something up, especially if you do not follow directions. I make no guarantee that this will work or that it won't do anything bad.
  • I try to give as much information as possible for debugging/troubleshooting. If there is something you think I can add to further this, let me know.
  • You will need UPX, Jacksum, Java, xdelta, and cp[1][2].
    cp, Jacksum, and Java are not strictly necessary; cp is needed for preparexdelta.bat (I can't figure out how to do it with copy or xcopy), and Jacksum (which depends on Java) is used to verify that everything is done correctly.
  • You must replace %rootdir% with the location of the programs (UPX/Jacksum/xdelta/cp).
  • You must cd to FirefoxPortable\App\firefox (this applies to all batch files.
  • The files in FirefoxPortable\App\firefox are modified; the files in the temp directory are not.
  • Since these are not ready for the regular joe, and is out for testing purposes mostly, the backup files made are not deleted. I strongly discourage using these batch files on a flash drive (copy FxP to a hard drive).
  • cp seems to give the backed up files the read-only flag.
  • You must use the original file as the argument. Remember to remove the read-only flag if you have to replace the modified file in FirefoxPortable\App\firefox.
  • You can change the options used by UPX and Jacksum, however, make sure that the changes are applied throughout the entire batch file (e.g. don't compare a sha256 sum to a sha1, don't use --best --all-methods the first time and -9 --all-filters the next)
  • xdelta does not tell you if the patch was applied correctly, but only if it could apply a patch.

File-specific:

  • preparexdelta.bat creates the temporary directories and copies the binary files to those directories. It doesn't accept any arguments.
  • xdeltatest.bat verifies that the whole process will indeed work. If the first checksum matches the last checksum, you should be good to go. If not, check that your directories are correct, that every program ran and did what it was supposed to do, and that the method/level/filter used by UPX are the same both times.
  • doxdelta.bat packs the files and creates the patch files. Patches are stored in FirefoxPortable\bak
  • prepareupdate.bat unpacks the files and restores them to the originals so that autoupdate can use a small update patch. The originals are re created in FirefoxPortable\likenew.

[Moderator RM: Fixed your link :)]

Vintage!

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2006-11-18 10:26
link dorked

Your first link for "cp" is dorked up. Not hard to work around however...

Edit: the link to the batch/zip file(s) gives the dreaded 404 error.

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
A mod will have to fix the

A mod will have to fix the cp link. The link to the batch files, however, is now valid.

Vintage!

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 4 months ago
Joined: 2006-04-07 08:44
Any comments for this

Any comments for this concept or implementation in general should be here. Anything for the batch files and especially for testing them should be in the Beta Testing thread.

Vintage!

Log in or register to post comments