2015-02-24 16:32:27 -05:00
|
|
|
#!/bin/bash
|
2015-04-21 11:51:58 -04:00
|
|
|
set -e
|
2015-02-26 12:56:13 -08:00
|
|
|
|
2015-04-21 11:51:58 -04:00
|
|
|
if [ -x '/usr/bin/apt-get' ]; then
|
|
|
|
if ! $(git --version &>/dev/null) ; then
|
|
|
|
sudo -H apt-get -y install git
|
|
|
|
fi
|
2015-06-18 22:57:33 -04:00
|
|
|
# To install python packages, we need pip.
|
|
|
|
#
|
|
|
|
# We can't use the apt packaged version of pip since
|
|
|
|
# older versions of pip are incompatible with
|
|
|
|
# requests, one of our indirect dependencies (bug 1459947).
|
|
|
|
#
|
|
|
|
# So we use easy_install to install pip.
|
|
|
|
#
|
|
|
|
# But we may not have easy_install; if that's the case,
|
|
|
|
# our bootstrap's bootstrap is to use apt to install
|
|
|
|
# python-setuptools to get easy_install.
|
|
|
|
if ! $(easy_install --version &>/dev/null) ; then
|
|
|
|
sudo -H apt-get -y install python-setuptools
|
|
|
|
fi
|
2015-06-15 16:25:02 -07:00
|
|
|
if ! $(dpkg -l libpython-dev &>/dev/null); then
|
|
|
|
sudo -H apt-get -y install libpython-dev
|
|
|
|
fi
|
2015-04-21 11:51:58 -04:00
|
|
|
elif [ -x '/usr/bin/yum' ]; then
|
2015-06-15 15:09:21 -07:00
|
|
|
if ! yum -q list installed python-devel; then
|
|
|
|
sudo -H yum -y install python-devel
|
|
|
|
fi
|
2015-06-15 16:25:02 -07:00
|
|
|
if ! $(gcc -v &>/dev/null); then
|
|
|
|
sudo -H yum -y install gcc
|
|
|
|
fi
|
2015-04-21 11:51:58 -04:00
|
|
|
if ! $(git --version &>/dev/null); then
|
|
|
|
sudo -H yum -y install git
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "ERROR: Supported package manager not found. Supported: apt,yum"
|
|
|
|
fi
|
|
|
|
|
2015-06-15 15:09:21 -07:00
|
|
|
if ! $(pip -v &>/dev/null); then
|
|
|
|
sudo easy_install pip
|
|
|
|
fi
|
|
|
|
|
2015-04-21 11:51:58 -04:00
|
|
|
sudo -E pip install -r "$(dirname $0)/../requirements.txt"
|
2015-02-26 12:56:13 -08:00
|
|
|
|
|
|
|
u=$(whoami)
|
|
|
|
g=$(groups | awk '{print $1}')
|
|
|
|
|
2015-04-07 09:41:30 -07:00
|
|
|
if [ ! -d /opt/stack ]; then
|
|
|
|
mkdir -p /opt/stack || (sudo mkdir -p /opt/stack)
|
|
|
|
fi
|
|
|
|
sudo -H chown -R $u:$g /opt/stack
|
2015-02-24 16:32:27 -05:00
|
|
|
cd /opt/stack
|
2015-02-26 12:56:13 -08:00
|
|
|
|
2015-06-02 07:29:09 -04:00
|
|
|
# NOTE(TheJulia): Switching to Ansible stable-1.9 branch as the development
|
|
|
|
# branch is undergoing some massive changes and we are seeing odd failures
|
|
|
|
# that we should not be seeing. Until devel has stabilized, we should stay
|
|
|
|
# on the stable branch.
|
2015-02-24 16:32:27 -05:00
|
|
|
if [ ! -d ansible ]; then
|
2015-06-02 07:29:09 -04:00
|
|
|
git clone https://github.com/ansible/ansible.git --recursive -b stable-1.9
|
2015-02-24 16:32:27 -05:00
|
|
|
else
|
|
|
|
cd ansible
|
2015-06-02 07:29:09 -04:00
|
|
|
git checkout stable-1.9
|
2015-04-16 15:03:14 -04:00
|
|
|
git pull --rebase
|
2015-02-24 16:32:27 -05:00
|
|
|
git submodule update --init --recursive
|
2015-04-07 15:45:12 -04:00
|
|
|
git fetch
|
2015-02-24 16:32:27 -05:00
|
|
|
fi
|
2015-02-26 12:56:13 -08:00
|
|
|
|
|
|
|
echo
|
2015-06-15 15:09:21 -07:00
|
|
|
echo "If you're using this script directly, execute the"
|
2015-04-21 11:51:58 -04:00
|
|
|
echo "following commands to update your shell."
|
2015-02-26 12:56:13 -08:00
|
|
|
echo
|
|
|
|
echo "source env-vars"
|
|
|
|
echo "source /opt/stack/ansible/hacking/env-setup"
|
2015-02-24 16:32:27 -05:00
|
|
|
echo
|