jafeha / parabird

Simple script written in python to build an os independent truecrypt encrypted usb-stick containing a portable thunderbird, enigmail, torbirdy and vidalia.
GNU General Public License v3.0
11 stars 7 forks source link

extract gpg binary for mac #35

Closed jojoo- closed 11 years ago

jojoo- commented 11 years ago

i was able to extract the gpg2 binary for osx, it was a bit tricky thou.

7z x MacGPG2.pkg Payload
7z x Payload Payload~
mkdir foobarbaz
7z e  -ofoobarbaz Payload~
export DYLD_LIBRARY_PATH=/tmp/foobarbaz/
chmod +x gpg2
./gpg2

we always need to set the path before one can use the binary. so we need to find a way to set this shell variable in enigmal, i really dont know how this is done...

jojoo- commented 11 years ago

seems like there is a way or that at least enigmail respects the variables of the current set shell http://comments.gmane.org/gmane.comp.mozilla.enigmail.general/12484

jojoo- commented 11 years ago

it is also possible to patch the hardcoded path to the librarys with install_name_tool:

cp gpg2 patchit
chmod a+x patchit
otool -l patchit
install_name_tool -change /usr/local/MacGPG2/lib/libintl.8.dylib libintl.8.dylib patchit
install_name_tool -change /usr/local/MacGPG2/lib/libiconv.2.dylib libiconv.2.dylib patchit
install_name_tool -change /usr/local/MacGPG2/lib/libgcrypt.11.dylib libgcrypt.11.dylib
install_name_tool -change /usr/local/MacGPG2/lib/libgcrypt.11.dylib libgcrypt.11.dylib patchit
install_name_tool -change /usr/local/MacGPG2/lib/libgpg-error.0.dylib libgpg-error.0.dylib patchit
install_name_tool -change /usr/local/MacGPG2/lib/libassuan.0.dylib libassuan.0.dylib patchit
ls -al libintl.8.dylib
otool -l patchit| grep "name" |grep "MacGPG"
otool -l patchit| grep "name"
find / -name libiconv.2.dylib
otool -l /private/tmp/foobarbaz/libintl.8.dylib
install_name_tool /private/tmp/foobarbaz/libintl.8.dylib -change /usr/local/MacGPG2/lib/libiconv.2.dylib libiconv.2.dylib
otool -l /private/tmp/foobarbaz/libgcrypt.11.dylib
install_name_tool /private/tmp/foobarbaz/libgcrypt.11.dylib -change /usr/local/MacGPG2/lib/libgpg-error.0.dylib libgpg-error.0.dylib
otool /private/tmp/foobarbaz/libassuan.0.dylib
otool -L /private/tmp/foobarbaz/libassuan.0.dylib
install_name_tool /private/tmp/foobarbaz/libassuan.0.dylib -change /usr/local/MacGPG2/lib/libgpg-error.0.dylib libgpg-error.0.dylib
./patchit
jojoo- commented 11 years ago

for 10.8 its esy to set enviroment variables: http://www.mobileread.com/forums/showthread.php?t=186069

jojoo- commented 11 years ago

create clickable shell scripts in OS X: http://stackoverflow.com/a/5126257/827941

the way is definetly to export DYLD_LIBRARY_PATH

anything else results in a patching nightmare

jafeha commented 11 years ago

i've tried to extract only those parts of the dmg file we need:

7z x GPGTools-20130330.dmg 2.hfs
7z x 2.hfs GPGTools_Installer/GPGTools_Installer.pkg
cd GPGTools_Installer
7z x GPGTools_Installer.pkg MacGPG2_Core.pkg/Payload
cd MacGPG2_Core.pkg
7z x Payload
7z x Payload~
cp -R usr/local/MacGPG2/ mountpoint/apps/mac/gpg/

or schematic:

1st run:    hfsfile
2nd run:    pkgfile
3rd run:    Payloadfiles (davon gibbet noch mehr)
4th run:    Payload
5th run:    Payload~
jafeha commented 11 years ago

this should be fixed afair