Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,19 @@ if [[ ! -e "${HOME?}/$BACKUP_FILE" ]]; then
&& mv "${HOME?}/$CONFIG_FILE" "${HOME?}/$CONFIG_FILE.uninstall" \
&& printf '\e[0;32m%s\e[0m\n' "Moved your ~/$CONFIG_FILE to ~/$CONFIG_FILE.uninstall."
else
# Create a backup of the current config before restoring the old one
# Use -L to dereference symlinks (for homesick/dotfile managers)
if [[ -e "${HOME?}/$CONFIG_FILE" ]]; then
cp -L "${HOME?}/$CONFIG_FILE" "${HOME?}/$CONFIG_FILE.pre-uninstall.bak"
printf '\e[0;33m%s\e[0m\n' "Current ~/$CONFIG_FILE backed up to ~/$CONFIG_FILE.pre-uninstall.bak"
fi

test -w "${HOME?}/$BACKUP_FILE" \
&& cp -a "${HOME?}/$BACKUP_FILE" "${HOME?}/$CONFIG_FILE" \
&& rm "${HOME?}/$BACKUP_FILE" \
&& printf '\e[0;32m%s\e[0m\n' "Your original ~/$CONFIG_FILE has been restored."

printf '\e[0;33m%s\e[0m\n' "NOTE: If you had made changes since installing Bash-it, they are preserved in ~/$CONFIG_FILE.pre-uninstall.bak"
fi

printf '\n\e[0;32m%s\e[0m\n\n' "Uninstallation finished successfully! Sorry to see you go!"
Expand Down
Loading