123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/bin/bash
- set -e
- COLOR_END='\e[0m'
- COLOR_RED='\e[0;31m'
- COLOR_YEL='\e[0;33m'
- DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
- ROOT_DIR=$(cd "$DIR/../../" && pwd)
- PYTHON_REQUIREMNTS_FILE="$DIR/python_requirements.txt"
- GEMFILE="$ROOT_DIR/Gemfile"
- msg_exit() {
- printf "$COLOR_RED$@$COLOR_END"
- printf "\n"
- printf "Exiting...\n"
- exit 1
- }
- msg_warning() {
- printf "$COLOR_YEL$@$COLOR_END"
- printf "\n"
- }
- system=$(uname)
- if [ "$system" == "Linux" ]; then
- distro=$(lsb_release -i)
- if [[ $distro == *"Ubuntu"* ]] || [[ $distro == *"Debian"* ]] ;then
- msg_warning "Your running Debian based linux.\n You might need to install 'sudo apt-get install build-essential python-dev\n."
-
- else
- msg_warning "Your linux system was not tested"
- fi
- fi
- [[ "$(whoami)" == "root" ]] && msg_exit "Please run as a normal user not root"
- [[ -z "$(which python)" ]] && msg_exit "Opps python is not installed or not in your path."
- [[ -z "$(which pip)" ]] && msg_exit "pip is not installed!\nYou can try'sudo easy_install pip'"
- [[ ! -f "$PYTHON_REQUIREMNTS_FILE" ]] && msg_exit "python_requirements '$PYTHON_REQUIREMNTS_FILE' does not exist or permssion issue.\nPlease check and rerun."
- [[ -z "$(which bundle)" ]] && msg_exit "Oops you need bundler to install ruby dependencies (http://bundler.io/)"
- echo "This script install python packages defined in '$PYTHON_REQUIREMNTS_FILE' "
- echo "Since we only support global packages installation for now we need root password."
- echo "You will be asked for your password."
- sudo -H pip install --upgrade --requirement "$PYTHON_REQUIREMNTS_FILE"
- echo "This script will now install ruby dependencies via bundler"
- bundle install --gemfile=$GEMFILE
- echo "Touching vault password file"
- if [ -w "$ROOT_DIR" ]
- then
- touch "$ROOT_DIR/.vault-password"
- else
- sudo touch "$ROOT_DIR/.vault-password"
- fi
- exit 0
|