/Patcher

Patches OSX Application Bundles

Primary LanguageRuby

Ruby OsX Application Bundle Patcher

What for?

This tiny ruby script patches specific files in application bundles, it reads all nessecary informations from a xml file. I was tired of patching manually...

Usage

  1. Create xml file with all information. The structure is simple:
<patches>
	<patch app="YourAppName" version="VersionNumber">
		<file path="PathToFile">
			<md5>md5 value of original file</md5>
			<code>
				<original>code to patch</original>
				<patched>replacement</patched>
			</code>
		</file>	
	</patch>
</patches>

<patches> can contain multiple <patch>-tags, as well as <patch> can contain more than one <file>-tags, <file> can contain multiple <md5>-tags and last but not least multiple <code>-tags. The original code should contain enough code to identify the correct location. Then the patched code replaces the original byte by byte from the beginning (please take a look at the example).

  1. Call patcher.rb with 2 parameters: $PathToApplication $PathToPatchFile

  2. You are done. A backup of the patched file was automatically created, in case something went wrong. The patcher appended the suffix .orig .

Example

There is an example application "HelloWorld.app" and a corresponding xml-file. Feel free to test it with ./patcher.rb ./HelloWorld.app/ ./patches.xml .

Acknowledgment

Torsten wrote the very first patch script, which inspired me to pimp it a bit. The sample application is taken from Andrew Nesbitt's blog: http://teabass.com/hello-world-in-cocoa/ , which was modified by me, to demonstrate how the patcher works.

Limitations

At the moment, this script only works with ruby version 1.8.7. I tested only what I needed for my stuff, so be careful.