2017-08-23 14:01:20 -04:00
|
|
|
# If new packages are installed by BootstrapMac below, this version number must
|
|
|
|
|
# be increased.
|
|
|
|
|
BOOTSTRAP_MAC_VERSION=1
|
|
|
|
|
|
2015-12-02 01:47:38 -05:00
|
|
|
BootstrapMac() {
|
2016-02-11 16:56:53 -05:00
|
|
|
if hash brew 2>/dev/null; then
|
2017-04-19 12:11:38 -04:00
|
|
|
say "Using Homebrew to install dependencies..."
|
2016-02-11 16:56:53 -05:00
|
|
|
pkgman=brew
|
|
|
|
|
pkgcmd="brew install"
|
|
|
|
|
elif hash port 2>/dev/null; then
|
2017-04-19 12:11:38 -04:00
|
|
|
say "Using MacPorts to install dependencies..."
|
2016-02-11 16:56:53 -05:00
|
|
|
pkgman=port
|
2017-08-21 15:23:09 -04:00
|
|
|
pkgcmd="port install"
|
2016-02-11 16:56:53 -05:00
|
|
|
else
|
2017-04-19 12:11:38 -04:00
|
|
|
say "No Homebrew/MacPorts; installing Homebrew..."
|
2016-02-11 16:56:53 -05:00
|
|
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
|
|
|
pkgman=brew
|
|
|
|
|
pkgcmd="brew install"
|
2015-12-02 01:47:38 -05:00
|
|
|
fi
|
|
|
|
|
|
2016-02-11 16:56:53 -05:00
|
|
|
$pkgcmd augeas
|
2016-05-15 05:44:48 -04:00
|
|
|
if [ "$(which python)" = "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python" \
|
|
|
|
|
-o "$(which python)" = "/usr/bin/python" ]; then
|
2016-02-11 16:56:53 -05:00
|
|
|
# We want to avoid using the system Python because it requires root to use pip.
|
|
|
|
|
# python.org, MacPorts or HomeBrew Python installations should all be OK.
|
2017-04-19 12:11:38 -04:00
|
|
|
say "Installing python..."
|
2016-02-11 16:56:53 -05:00
|
|
|
$pkgcmd python
|
2016-02-12 12:09:29 -05:00
|
|
|
fi
|
|
|
|
|
|
2017-01-10 15:24:15 -05:00
|
|
|
# Workaround for _dlopen not finding augeas on macOS
|
2016-02-11 16:56:53 -05:00
|
|
|
if [ "$pkgman" = "port" ] && ! [ -e "/usr/local/lib/libaugeas.dylib" ] && [ -e "/opt/local/lib/libaugeas.dylib" ]; then
|
2017-04-19 12:11:38 -04:00
|
|
|
say "Applying augeas workaround"
|
2017-08-21 15:23:09 -04:00
|
|
|
mkdir -p /usr/local/lib/
|
|
|
|
|
ln -s /opt/local/lib/libaugeas.dylib /usr/local/lib/
|
2016-02-12 12:09:29 -05:00
|
|
|
fi
|
2015-12-02 01:47:38 -05:00
|
|
|
|
2016-02-11 16:56:53 -05:00
|
|
|
if ! hash pip 2>/dev/null; then
|
2017-04-19 12:11:38 -04:00
|
|
|
say "pip not installed"
|
|
|
|
|
say "Installing pip..."
|
2017-01-19 14:34:10 -05:00
|
|
|
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python
|
2015-12-02 01:47:38 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if ! hash virtualenv 2>/dev/null; then
|
2017-04-19 12:11:38 -04:00
|
|
|
say "virtualenv not installed."
|
|
|
|
|
say "Installing with pip..."
|
2017-01-19 14:34:10 -05:00
|
|
|
pip install virtualenv
|
2015-12-02 01:47:38 -05:00
|
|
|
fi
|
2015-12-02 02:01:22 -05:00
|
|
|
}
|