Commit 7a95c374 by Xavier Antoviaque Committed by David Baumgold

Install: Options "-q" (quiet), "-n" (no pull), "-y" (non interactive)

Added several options to the `create-dev-env.sh` script to improve its
ability to be used by another script:

* -y -- non interactive mode (no prompt, proceed immediately)
* -n -- do not attempt to pull edx-platform
* -q -- be more quiet (removes info at beginning & end)

This will be used, in particular, for Vagrant provisioning.
parent ba8c2999
...@@ -49,8 +49,11 @@ usage() { ...@@ -49,8 +49,11 @@ usage() {
Usage: $PROG [-c] [-v] [-h] Usage: $PROG [-c] [-v] [-h]
-y non interactive mode (no prompt, proceed immediately)
-c compile scipy and numpy -c compile scipy and numpy
-n do not attempt to pull edx-platform
-s give access to global site-packages for virtualenv -s give access to global site-packages for virtualenv
-q be more quiet (removes info at beginning & end)
-v set -x + spew -v set -x + spew
-h this -h this
...@@ -78,10 +81,11 @@ change_git_push_defaults() { ...@@ -78,10 +81,11 @@ change_git_push_defaults() {
clone_repos() { clone_repos() {
change_git_push_defaults
cd "$BASE" cd "$BASE"
if [[ ! $nopull ]]; then
change_git_push_defaults
if [[ -d "$BASE/edx-platform/.git" ]]; then if [[ -d "$BASE/edx-platform/.git" ]]; then
output "Pulling edx platform" output "Pulling edx platform"
cd "$BASE/edx-platform" cd "$BASE/edx-platform"
...@@ -94,6 +98,7 @@ clone_repos() { ...@@ -94,6 +98,7 @@ clone_repos() {
fi fi
git clone https://github.com/edx/edx-platform.git git clone https://github.com/edx/edx-platform.git
fi fi
fi
} }
set_base_default() { # if PROJECT_HOME not set set_base_default() { # if PROJECT_HOME not set
...@@ -149,7 +154,7 @@ if [[ "x$VIRTUAL_ENV" != "x" ]]; then ...@@ -149,7 +154,7 @@ if [[ "x$VIRTUAL_ENV" != "x" ]]; then
fi fi
# Read arguments # Read arguments
ARGS=$(getopt "cvhs" "$*") ARGS=$(getopt "cvhsynq" "$*")
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
usage usage
exit 1 exit 1
...@@ -170,6 +175,18 @@ while true; do ...@@ -170,6 +175,18 @@ while true; do
verbose=true verbose=true
shift shift
;; ;;
-y)
noninteractive=true
shift
;;
-q)
quiet=true
shift
;;
-n)
nopull=true
shift
;;
-h) -h)
usage usage
exit 0 exit 0
...@@ -181,7 +198,8 @@ while true; do ...@@ -181,7 +198,8 @@ while true; do
esac esac
done done
cat<<EO if [[ ! $quiet ]]; then
cat<<EO
This script will setup a local edX environment, this This script will setup a local edX environment, this
includes includes
...@@ -201,10 +219,13 @@ cat<<EO ...@@ -201,10 +219,13 @@ cat<<EO
shell. shell.
EO EO
info fi
output "Press return to begin or control-C to abort" info
read dummy
if [[ ! $noninteractive ]]; then
output "Press return to begin or control-C to abort"
read dummy
fi
# Log all stdout and stderr # Log all stdout and stderr
...@@ -225,6 +246,7 @@ case `uname -s` in ...@@ -225,6 +246,7 @@ case `uname -s` in
distro=`lsb_release -cs` distro=`lsb_release -cs`
case $distro in case $distro in
wheezy|jessie|maya|olivia|nadia|precise|quantal) wheezy|jessie|maya|olivia|nadia|precise|quantal)
if [[ ! $noninteractive ]]; then
warning " warning "
Debian support is not fully debugged. Assuming you have standard Debian support is not fully debugged. Assuming you have standard
development packages already working like scipy rvm, the development packages already working like scipy rvm, the
...@@ -236,8 +258,10 @@ case `uname -s` in ...@@ -236,8 +258,10 @@ case `uname -s` in
Press return to continue or control-C to abort" Press return to continue or control-C to abort"
read dummy read dummy
sudo apt-get install git ;; fi
sudo apt-get install -yq git ;;
squeeze|lisa|katya|oneiric|natty|raring) squeeze|lisa|katya|oneiric|natty|raring)
if [[ ! $noninteractive ]]; then
warning " warning "
It seems like you're using $distro which has been deprecated. It seems like you're using $distro which has been deprecated.
While we don't technically support this release, the install While we don't technically support this release, the install
...@@ -248,7 +272,8 @@ case `uname -s` in ...@@ -248,7 +272,8 @@ case `uname -s` in
Press return to continue or control-C to abort" Press return to continue or control-C to abort"
read dummy read dummy
sudo apt-get install git fi
sudo apt-get install -yq git
;; ;;
*) *)
...@@ -529,7 +554,8 @@ git config --global push.default current ...@@ -529,7 +554,8 @@ git config --global push.default current
### DONE ### DONE
cat<<END if [[ ! $quiet ]]; then
cat<<END
Success!! Success!!
To start using Django you will need to activate the local Python To start using Django you will need to activate the local Python
...@@ -567,4 +593,6 @@ cat<<END ...@@ -567,4 +593,6 @@ cat<<END
END END
fi
exit 0 exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment