From b90e1628ddaf283ddaecc9163fe9e6395b4d30a7 Mon Sep 17 00:00:00 2001 From: cgoodale Date: Thu, 19 Jun 2014 21:55:29 -0700 Subject: [PATCH] Add check for existing ocw virtualenv --- easy-ocw/install-osx.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/easy-ocw/install-osx.sh b/easy-ocw/install-osx.sh index 1e6a2489..ca7581f8 100755 --- a/easy-ocw/install-osx.sh +++ b/easy-ocw/install-osx.sh @@ -131,6 +131,30 @@ if [ $WITH_VIRTUAL_ENV == 1 ]; then subtask "done" fi + header "Checking for previously installed ocw virtual environment..." + if [ -e ~/ocw/bin/python ]; then + echo "We found an existing 'ocw' virtualenv on your system in ~/ocw." + read -n1 -p "Do you want to replace it with a clean install? y/n :" replace + if [ "$replace" == "y" ]; then + echo "" + echo "WARNING this will delete all file and data in ~/ocw on your system." + read -p "To confirm and proceed type YES or ENTER to quit:" confirm + if [ "$confirm" == "YES" ]; then + echo "Deleting contents of ~/ocw" >> install_log + rm -rf ~/ocw + else + echo "" + echo "Stopping Open Climate Workbench Installation" + exit + fi + else + echo "" + echo "Stopping Open Climate Workbench Installation because an existing 'ocw'" + echo "virtual environment already exists." + exit + fi + fi + # Create a new environment for OCW work task "Creating a new environment in ~/ocw..." cd ~