From fb993d17b658ee24c73485414ecb888801f11bc2 Mon Sep 17 00:00:00 2001 From: Marco Vermeulen Date: Sat, 29 Sep 2012 20:51:04 +0100 Subject: [PATCH] No longer adds snippets to .bashrc, .bash_profile and .profile on subsequent runs of install script. --- srv/scripts/install.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/srv/scripts/install.sh b/srv/scripts/install.sh index e5480c91..3cb83285 100755 --- a/srv/scripts/install.sh +++ b/srv/scripts/install.sh @@ -141,21 +141,27 @@ if [ ! -f "$PROFILE" -a ! -f "$BASHRC" ]; then echo "Created and updated .profile and .bashrc" else if [ -f "$BASHRC" ]; then - echo "" >> "$BASHRC" - echo "$SNIPPET" >> "$BASHRC" - echo "Updated existing .bashrc" + if [ -z "$(grep 'gvm-init.sh' $BASHRC)" ]; then + echo "" >> "$BASHRC" + echo "$SNIPPET" >> "$BASHRC" + echo "Updated existing .bashrc" + fi fi if [ -f "$BASH_PROFILE" ]; then - echo "" >> "$BASH_PROFILE" - echo "$SNIPPET" >> "$BASH_PROFILE" - echo "Updated existing .bash_profile" + if [ -z "$(grep 'gvm-init.sh' $BASH_PROFILE)" ]; then + echo "" >> "$BASH_PROFILE" + echo "$SNIPPET" >> "$BASH_PROFILE" + echo "Updated existing .bash_profile" + fi fi if [ -f "$PROFILE" ]; then - echo "" >> "$PROFILE" - echo "$SNIPPET" >> "$PROFILE" - echo "Updated existing .profile" + if [ -z "$(grep 'gvm-init.sh' $PROFILE)" ]; then + echo "" >> "$PROFILE" + echo "$SNIPPET" >> "$PROFILE" + echo "Updated existing .profile" + fi fi fi