From 815a20050477f891a810c150a5776158eef50ec8 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Sat, 22 Oct 2011 08:03:23 +0000 Subject: [PATCH] added more control to appending of .bashrc in biopieces_installer.sh git-svn-id: http://biopieces.googlecode.com/svn/trunk@1594 74ccb610-7750-0410-82ae-013aeee3265d --- bp_scripts/biopieces_installer.sh | 38 ++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/bp_scripts/biopieces_installer.sh b/bp_scripts/biopieces_installer.sh index cbe5f9f..c0f51c9 100755 --- a/bp_scripts/biopieces_installer.sh +++ b/bp_scripts/biopieces_installer.sh @@ -94,7 +94,7 @@ function prompt_install echo "" echo " http://code.google.com/p/biopieces/wiki/Installation" echo "" - echo " If you experience problems, please report to the Google Group (see below)" + echo " If you experience problems, please report to the Google Group (see below)." echo "" echo " The installer will now do the following:" echo "" @@ -324,17 +324,43 @@ source \"\$BP_DIR/bp_conf/bashrc\" if [ $skip == 1 ]; then echo "Skipping" else + if [ -f "$HOME/.bashrc" ]; then + echo "Existing .bashrc file located: $HOME/.bashrc" + echo -n "Creating backup: " + + if ! cp "$HOME/.bashrc" "$HOME/.bashrc_biopieces"; then + echo_red "FAIL" + abort + else + echo_green "OK" + echo " Backup is $HOME/.bashrc_biopieces" + fi + fi + echo -n "Appending $HOME/.bashrc: " - cp "$HOME/.bashrc" "$HOME/.bashrc_biopieces" + if ! echo "$section" >> "$HOME/.bashrc"; then + echo_red "FAIL" + abort + else + echo_green "OK" + fi - echo "$section" >> "$HOME/.bashrc" + echo -n "Sourcing $HOME/.bashrc: " - source "$HOME/.bashrc" + if ! source "$HOME/.bashrc"; then + echo_red "FAIL" + abort + else + echo_green "OK" + fi - echo_green "OK" echo "" - echo " Backup is $HOME/.bashrc_biopieces" + echo " \$BP_DIR is now set to: $BP_DIR" + echo " \$BP_DATA is now set to: $BP_DATA" + echo " \$BP_TMP is now set to: $BP_TMP" + echo " \$BP_LOG is now set to: $BP_LOG" + echo "" fi } -- 2.39.2