Added support to add a license file to the DMG #14

merged 1 commit into from Jan 3, 2013


None yet
3 participants

wesen commented Jan 3, 2013

The license file support was not usable (missing options, and old call to ResMerger).

I added a python script to generate the resource fork starting with a txt file, and put the
script in support/.

I also added a call to readlink to resolve the support/ path as I usually symlink my binaries
into /usr/local/bin .

Hope that helps!

@andreyvit andreyvit added a commit that referenced this pull request Jan 3, 2013

@andreyvit andreyvit Merge pull request #14 from wesen/master
Support for adding a license file to the DMG

@andreyvit andreyvit merged commit c330c44 into andreyvit:master Jan 3, 2013


andreyvit commented Jan 3, 2013

Thanks for fixing it!


wesen commented Jan 3, 2013

my readlink fix is actually broken, i switched to greadlink -f, but greadlink is not installed by default. recursive solutions for symlinks are quite ugly...


andreyvit commented Jan 4, 2013

So what do we do about that? How broken is readlink? Any chance to use something like a Perl or Ruby script for that?

Try this:

ruby -e 'puts File.expand_path(File.readlink(ARGV.first), File.dirname(ARGV.first))' -- /tmp

should work with relative and absolute symlinks.


andreyvit commented Jan 4, 2013

...although, if you want to resolve links and keep everything else intact, try this instead:

ruby -e 'puts((File.expand_path(File.readlink(ARGV.first), File.dirname(ARGV.first)) rescue ARGV.first))' -- /tmp

wesen commented Jan 4, 2013

the ruby sounds good! :)

Using readlink here breaks the script.

According to man, "When invoked as readlink, only the target of the symbolic link is printed. If the given argument is not a symbolic link, readlink will print nothing and exit with an error.".

Since $0 (create-dmg) is not a symlink, nothing is printed, thus line 118 of the script is interpreted as:

which results in the error output: "usage: dirname path"


wesen replied Jan 8, 2013

yep, I switched this to greadlink, which works in a more sensible way. Andrey has a small ruby oneliner that does the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment