From b68472c959912392d94a6c8a23779101ac2fa74d Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Tue, 21 Jul 2015 12:19:01 +0200 Subject: [PATCH 1/3] Added first draft of uninstall script --- uninstall.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 uninstall.sh diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 00000000..fad6e569 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +BASH_IT="$HOME/.bash_it" + +case $OSTYPE in + darwin*) + CONFIG_FILE=.bash_profile + ;; + *) + CONFIG_FILE=.bashrc + ;; +esac + +BACKUP_FILE=$CONFIG_FILE.bak + +if [ ! -e "$HOME/$BACKUP_FILE" ]; then + echo -e "\033[0;33mBackup file "$HOME/$BACKUP_FILE" not found.\033[0m" >&2 + + test -w "$HOME/$CONFIG_FILE" && + mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall" && + echo -e "\033[0;32mMoved your $HOME/$CONFIG_FILE to $HOME/$CONFIG_FILE.uninstall.\033[0m" +else + test -w "$HOME/$BACKUP_FILE" && + cp -a "$HOME/$BACKUP_FILE" "$HOME/$CONFIG_FILE" && + rm "$HOME/$BACKUP_FILE" && + echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m" +fi + +echo "" +echo -e "\033[0;32mUninstallation finished successfully! Sorry to see you go!\033[0m" +echo "" +echo "Final steps to complete the uninstallation:" +echo " -> Remove the $BASH_IT folder" +echo " -> Open a new shell/tab/terminal" From 2f64aaec6ce534d7ea35c0963f5cee35c1f3ce27 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Tue, 4 Aug 2015 10:32:36 +0200 Subject: [PATCH 2/3] Added uninstall instructions --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f67de351..ab63b9bb 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,14 @@ Alternatively, you can preview the themes in your own shell using `BASH_PREVIEW= ## Uninstalling -There is no automatic uninstall process. To return to your old, boring bash experience, do `rm -rf ~/.bash_it`, followed by `mv ~/.bashrc.bak ~/.bashrc` (on Linux), or `mv ~/.bash_profile.bak ~/.bash_profile` (on Mac). Start a new shell, and Bash it will be gone... +To uninstall Bash it, run the `uninstall.sh` script found in the `$BASH_IT` directory: + +``` +cd $BASH_IT +./uninstall.sh +``` + +This will restore your previous Bash profile. After the uninstall script finishes, remove the Bash it directory from your machine (`rm -rf $BASH_IT`) and start a new shell. ## Misc From 1553a7ad80ae4027be94093a4b9f11e68e7adfb5 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Tue, 4 Aug 2015 10:39:30 +0200 Subject: [PATCH 3/3] Only setting environment variable if not already set --- uninstall.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uninstall.sh b/uninstall.sh index fad6e569..18d88e80 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash -BASH_IT="$HOME/.bash_it" +if [ -z "$BASH_IT" ]; +then + BASH_IT="$HOME/.bash_it" +fi case $OSTYPE in darwin*)