Commit 1279c860 by John Jarvis

by default now stdout and stdin will appear on console, both are logged

parent 202b18a3
...@@ -17,8 +17,10 @@ ouch() { ...@@ -17,8 +17,10 @@ ouch() {
!! ERROR !! !! ERROR !!
The last command did not complete successfully, The last command did not complete successfully,
see $LOG for more details or trying running the For more details or trying running the
script again with the -v flag. script again with the -v flag.
Output of the script is recorded in $LOG
EOL EOL
printf '\E[0m' printf '\E[0m'
...@@ -61,26 +63,26 @@ clone_repos() { ...@@ -61,26 +63,26 @@ clone_repos() {
if [[ -d "$BASE/mitx/.git" ]]; then if [[ -d "$BASE/mitx/.git" ]]; then
output "Pulling mitx" output "Pulling mitx"
cd "$BASE/mitx" cd "$BASE/mitx"
git pull >>$LOG git pull
else else
output "Cloning mitx" output "Cloning mitx"
if [[ -d "$BASE/mitx" ]]; then if [[ -d "$BASE/mitx" ]]; then
mv "$BASE/mitx" "${BASE}/mitx.bak.$$" mv "$BASE/mitx" "${BASE}/mitx.bak.$$"
fi fi
git clone git@github.com:MITx/mitx.git >>$LOG git clone git@github.com:MITx/mitx.git
fi fi
cd "$BASE" cd "$BASE"
if [[ -d "$BASE/askbot-devel/.git" ]]; then if [[ -d "$BASE/askbot-devel/.git" ]]; then
output "Pulling askbot-devel" output "Pulling askbot-devel"
cd "$BASE/askbot-devel" cd "$BASE/askbot-devel"
git pull >>$LOG git pull
else else
output "Cloning askbot-devel" output "Cloning askbot-devel"
if [[ -d "$BASE/askbot-devel" ]]; then if [[ -d "$BASE/askbot-devel" ]]; then
mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$"
fi fi
git clone git@github.com:MITx/askbot-devel >>$LOG git clone git@github.com:MITx/askbot-devel
fi fi
# By default, dev environments start with a copy of 6.002x # By default, dev environments start with a copy of 6.002x
...@@ -90,14 +92,14 @@ clone_repos() { ...@@ -90,14 +92,14 @@ clone_repos() {
if [[ -d "$BASE/data/$REPO/.git" ]]; then if [[ -d "$BASE/data/$REPO/.git" ]]; then
output "Pulling $REPO" output "Pulling $REPO"
cd "$BASE/data/$REPO" cd "$BASE/data/$REPO"
git pull >>$LOG git pull
else else
output "Cloning $REPO" output "Cloning $REPO"
if [[ -d "$BASE/data/$REPO" ]]; then if [[ -d "$BASE/data/$REPO" ]]; then
mv "$BASE/data/$REPO" "${BASE}/data/$REPO.bak.$$" mv "$BASE/data/$REPO" "${BASE}/data/$REPO.bak.$$"
fi fi
cd "$BASE/data" cd "$BASE/data"
git clone git@github.com:MITx/$REPO >>$LOG git clone git@github.com:MITx/$REPO
fi fi
} }
...@@ -109,7 +111,7 @@ RUBY_VER="1.9.3" ...@@ -109,7 +111,7 @@ RUBY_VER="1.9.3"
NUMPY_VER="1.6.2" NUMPY_VER="1.6.2"
SCIPY_VER="0.10.1" SCIPY_VER="0.10.1"
BREW_FILE="$BASE/mitx/brew-formulas.txt" BREW_FILE="$BASE/mitx/brew-formulas.txt"
LOG="/var/tmp/install.log" LOG="/var/tmp/install-$(date +%Y%m%d-%H%M%S).log"
APT_PKGS="curl git python-virtualenv build-essential python-dev gfortran liblapack-dev libfreetype6-dev libpng12-dev libxml2-dev libxslt-dev yui-compressor coffeescript" APT_PKGS="curl git python-virtualenv build-essential python-dev gfortran liblapack-dev libfreetype6-dev libpng12-dev libxml2-dev libxslt-dev yui-compressor coffeescript"
if [[ $EUID -eq 0 ]]; then if [[ $EUID -eq 0 ]]; then
...@@ -163,15 +165,15 @@ cat<<EO ...@@ -163,15 +165,15 @@ cat<<EO
To compile scipy and numpy from source use the -c option To compile scipy and numpy from source use the -c option
Most of STDOUT is redirected to /var/tmp/install.log, run
$ tail -f /var/tmp/install.log
to monitor progress
EO EO
info info
output "Press return to begin or control-C to abort" output "Press return to begin or control-C to abort"
read dummy read dummy
# log all stdout and stderr
exec > >(tee $LOG)
exec 2>&1
if [[ -f $HOME/.rvmrc ]]; then if [[ -f $HOME/.rvmrc ]]; then
output "$HOME/.rvmrc alredy exists, not adding $RUBY_DIR" output "$HOME/.rvmrc alredy exists, not adding $RUBY_DIR"
else else
...@@ -179,7 +181,6 @@ else ...@@ -179,7 +181,6 @@ else
echo "export rvm_path=$RUBY_DIR" > $HOME/.rvmrc echo "export rvm_path=$RUBY_DIR" > $HOME/.rvmrc
fi fi
mkdir -p $BASE mkdir -p $BASE
rm -f $LOG
case `uname -s` in case `uname -s` in
[Ll]inux) [Ll]inux)
command -v lsb_release &>/dev/null || { command -v lsb_release &>/dev/null || {
...@@ -207,7 +208,7 @@ case `uname -s` in ...@@ -207,7 +208,7 @@ case `uname -s` in
} }
command -v git &>/dev/null || { command -v git &>/dev/null || {
output "Installing git" output "Installing git"
brew install git >> $LOG brew install git
} }
clone_repos clone_repos
...@@ -221,16 +222,16 @@ case `uname -s` in ...@@ -221,16 +222,16 @@ case `uname -s` in
for pkg in $(cat $BREW_FILE); do for pkg in $(cat $BREW_FILE); do
grep $pkg <(brew list) &>/dev/null || { grep $pkg <(brew list) &>/dev/null || {
output "Installing $pkg" output "Installing $pkg"
brew install $pkg >>$LOG brew install $pkg
} }
done done
command -v pip &>/dev/null || { command -v pip &>/dev/null || {
output "Installing pip" output "Installing pip"
sudo easy_install pip >>$LOG sudo easy_install pip
} }
command -v virtualenv &>/dev/null || { command -v virtualenv &>/dev/null || {
output "Installing virtualenv" output "Installing virtualenv"
sudo pip install virtualenv virtualenvwrapper >> $LOG sudo pip install virtualenv virtualenvwrapper
} }
command -v coffee &>/dev/null || { command -v coffee &>/dev/null || {
output "Installing coffee script" output "Installing coffee script"
...@@ -273,24 +274,24 @@ if [[ -n $compile ]]; then ...@@ -273,24 +274,24 @@ if [[ -n $compile ]]; then
rm -f numpy.tar.gz scipy.tar.gz rm -f numpy.tar.gz scipy.tar.gz
output "Compiling numpy" output "Compiling numpy"
cd "$BASE/numpy-${NUMPY_VER}" cd "$BASE/numpy-${NUMPY_VER}"
python setup.py install >>$LOG 2>&1 python setup.py install
output "Compiling scipy" output "Compiling scipy"
cd "$BASE/scipy-${SCIPY_VER}" cd "$BASE/scipy-${SCIPY_VER}"
python setup.py install >>$LOG 2>&1 python setup.py install
cd "$BASE" cd "$BASE"
rm -rf numpy-${NUMPY_VER} scipy-${SCIPY_VER} rm -rf numpy-${NUMPY_VER} scipy-${SCIPY_VER}
fi fi
output "Installing askbot requirements" output "Installing askbot requirements"
pip install -r askbot-devel/askbot_requirements.txt >>$LOG pip install -r askbot-devel/askbot_requirements.txt
output "Installing askbot-dev requirements" output "Installing askbot-dev requirements"
pip install -r askbot-devel/askbot_requirements_dev.txt >>$LOG pip install -r askbot-devel/askbot_requirements_dev.txt
output "Installing MITx pre-requirements" output "Installing MITx pre-requirements"
pip install -r mitx/pre-requirements.txt >> $LOG pip install -r mitx/pre-requirements.txt
# Need to be in the mitx dir to get the paths to local modules right # Need to be in the mitx dir to get the paths to local modules right
output "Installing MITx requirements" output "Installing MITx requirements"
cd mitx cd mitx
pip install -r requirements.txt >>$LOG pip install -r requirements.txt
mkdir "$BASE/log" || true mkdir "$BASE/log" || true
mkdir "$BASE/db" || true mkdir "$BASE/db" || true
......
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