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,21 +81,23 @@ change_git_push_defaults() { ...@@ -78,21 +81,23 @@ change_git_push_defaults() {
clone_repos() { clone_repos() {
change_git_push_defaults
cd "$BASE" cd "$BASE"
if [[ -d "$BASE/edx-platform/.git" ]]; then if [[ ! $nopull ]]; then
output "Pulling edx platform" change_git_push_defaults
cd "$BASE/edx-platform"
git pull if [[ -d "$BASE/edx-platform/.git" ]]; then
else output "Pulling edx platform"
output "Cloning edx platform" cd "$BASE/edx-platform"
if [[ -d "$BASE/edx-platform" ]]; then git pull
output "Creating backup for existing edx platform" else
mv "$BASE/edx-platform" "${BASE}/edx-platform.bak.$$" output "Cloning edx platform"
if [[ -d "$BASE/edx-platform" ]]; then
output "Creating backup for existing edx platform"
mv "$BASE/edx-platform" "${BASE}/edx-platform.bak.$$"
fi
git clone https://github.com/edx/edx-platform.git
fi fi
git clone https://github.com/edx/edx-platform.git
fi fi
} }
...@@ -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
...@@ -224,32 +245,36 @@ case `uname -s` in ...@@ -224,32 +245,36 @@ 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)
warning " if [[ ! $noninteractive ]]; then
Debian support is not fully debugged. Assuming you have standard warning "
development packages already working like scipy rvm, the Debian support is not fully debugged. Assuming you have standard
installation should go fine, but this is still a work in progress. development packages already working like scipy rvm, the
installation should go fine, but this is still a work in progress.
Please report issues you have and let us know if you are able to figure Please report issues you have and let us know if you are able to figure
out any workarounds or solutions out any workarounds or solutions
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)
warning " if [[ ! $noninteractive ]]; then
It seems like you're using $distro which has been deprecated. warning "
While we don't technically support this release, the install It seems like you're using $distro which has been deprecated.
script will probably still work. While we don't technically support this release, the install
script will probably still work.
Raring requires an install of rvm to work correctly as the raring Raring requires an install of rvm to work correctly as the raring
package manager does not yet include a package for rvm package manager does not yet include a package for rvm
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
;;
*) *)
error "Unsupported distribution - $distro" error "Unsupported distribution - $distro"
...@@ -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