diff --git a/README.rst b/README.rst index 506176941..5558ae3a9 100644 --- a/README.rst +++ b/README.rst @@ -83,6 +83,10 @@ Usage Let's pretend you want to create a Django project called "redditclone". Rather than using `startproject` and then editing the results to include your name, email, and various configuration issues that always get forgotten until the worst possible moment, get cookiecutter_ to do all the work. +Install necessary dependencies (tested on ubuntu 14.04):: + $ apt-get update && apt-get upgrade && apt-get dist-upgrade && apt-get install build-essential git + $ pip install pyyaml markupsafe + First, get cookiecutter. Trust me, it's awesome:: $ pip install cookiecutter diff --git a/{{cookiecutter.repo_name}}/install_os_dependencies.sh b/{{cookiecutter.repo_name}}/install_os_dependencies.sh index aea9dec45..1c55737e0 100755 --- a/{{cookiecutter.repo_name}}/install_os_dependencies.sh +++ b/{{cookiecutter.repo_name}}/install_os_dependencies.sh @@ -1,6 +1,14 @@ #!/bin/bash -OS_REQUIREMENTS_FILENAME="requirements.apt" +## Verify that we are running this script on Centos or Ubuntu +command -v lsb_release >/dev/null 2>&1 || { echo >&2 "This setup script only currently works on Centos and Ubuntu. Aborting."; exit 1; } + +## Get the Distribution type from lsb_release +OS=$(lsb_release -si) +case "$OS" in + CentOS) OS_REQUIREMENTS_FILENAME="requirements.yum";; + Ubuntu) OS_REQUIREMENTS_FILENAME="requirements.apt";; +esac # Handle call with wrong command function wrong_command() @@ -29,12 +37,18 @@ function list_packages(){ function install() { - list_packages | xargs apt-get --no-upgrade install -y; + case "$OS" in + CentOS) list_packages | xargs yum install -y;; + Ubuntu) list_packages | xargs apt-get --no-upgrade install -y;; + esac } function upgrade() { - list_packages | xargs apt-get install -y; + case "$OS" in + CentOS) list_packages | xargs yum install -y;; + Ubuntu) list_packages | xargs apt-get install -y;; + esac } @@ -51,8 +65,10 @@ function install_or_upgrade() exit 1 else - - apt-get update + case "$OS" in + CentOS) yum update;; + Ubuntu) apt-get clean;; + esac # Install the basic compilation dependencies and other required libraries of this project if [ "$PARAN" == "install" ]; then @@ -62,15 +78,16 @@ function install_or_upgrade() fi # cleaning downloaded packages from apt-get cache - apt-get clean - + case "$OS" in + CentOS) yum clean all;; + Ubuntu) apt-get clean;; + esac exit 0 fi } - # Handle command argument case "$1" in install) install_or_upgrade;; @@ -79,4 +96,3 @@ case "$1" in help) usage_message;; *) wrong_command $1;; esac - diff --git a/{{cookiecutter.repo_name}}/requirements.yum b/{{cookiecutter.repo_name}}/requirements.yum new file mode 100755 index 000000000..30da5abe1 --- /dev/null +++ b/{{cookiecutter.repo_name}}/requirements.yum @@ -0,0 +1 @@ +autoconf automake binutils bison flex gcc gcc-c++ gettext libtool make patch pkgconfig redhat-rpm-config rpm-build gettext python-devel zlib-devel nodejs-pg libtiff-devel libtiff libtiff-static libjpeg-turbo libjpeg-turbo-static libjpeg-turbo-devel graphviz-devel python-setuptools python-devel python-virtualenv python-pip firefox libreadline-java sqlite-devel libxml2-python libxml2-static libxml2 libxml2-devel openssl-devel bzip2 wget curl llvm postgresql-server