Created
December 26, 2014 20:46
-
-
Save tcooper/1615e3a625e2a9c3db45 to your computer and use it in GitHub Desktop.
Building a patched BASH on OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Original from: http://apple.stackexchange.com/a/146851 | |
# If you want to disable auto-imported functions, uncomment the following | |
#export ADD_IMPORT_FUNCTIONS_PATCH=YES | |
mkdir ~/bash-fix | |
cd ~/bash-fix | |
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf - | |
cd bash-92/bash-3.2 | |
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0 | |
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0 | |
# See note above about ADD_IMPORT_FUNCTIONS_PATCH | |
#[ "$ADD_IMPORT_FUNCTIONS_PATCH" == "YES" ] && curl http://alblue.bandlem.com/import_functions.patch | patch -p0 | |
[ "$ADD_IMPORT_FUNCTIONS_PATCH" == "YES" ] || curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-054 | patch -p0 | |
cd .. | |
# Note: DO NOT ADD SUDO TO XCODEBUILD HERE | |
xcodebuild | |
~/bash-fix/bash-92/build/Release/bash --version # GNU bash, version 3.2.54(1)-release | |
~/bash-fix/bash-92/build/Release/sh --version # GNU bash, version 3.2.54(1)-release | |
echo "Run the following to 'install' the patched bash..." | |
echo "sudo cp -p /bin/bash /bin/bash.old" | |
echo "sudo cp -p /bin/sh /bin/sh.old" | |
echo "sudo cp ~/bash-fix/bash-92/build/Release/bash /bin" | |
echo "sudo cp ~/bash-fix/bash-92/build/Release/sh /bin" | |
echo "sudo chmod a-x /bin/bash.old" | |
echo "sudo chmod a-x /bin/sh.old" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment