parent
4c5e87e545
commit
0485778117
20
uninstall.sh
20
uninstall.sh
|
|
@ -1,4 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Since we're uninstalling, avoid depending on any other part of _Bash It_.
|
||||||
|
# I.e., hard-code colors (avoid `lib/colors.bash`), &c.
|
||||||
|
|
||||||
: "${BASH_IT:=${HOME?}/.bash_it}"
|
: "${BASH_IT:=${HOME?}/.bash_it}"
|
||||||
|
|
||||||
CONFIG_FILE=".bashrc"
|
CONFIG_FILE=".bashrc"
|
||||||
|
|
@ -10,21 +14,19 @@ fi
|
||||||
BACKUP_FILE=$CONFIG_FILE.bak
|
BACKUP_FILE=$CONFIG_FILE.bak
|
||||||
|
|
||||||
if [[ ! -e "${HOME?}/$BACKUP_FILE" ]]; then
|
if [[ ! -e "${HOME?}/$BACKUP_FILE" ]]; then
|
||||||
echo -e "\033[0;33mBackup file ${HOME?}/$BACKUP_FILE not found.\033[0m" >&2
|
printf '\e[0;33m%s\e[0m\n' "Backup file ~/$BACKUP_FILE not found."
|
||||||
|
|
||||||
test -w "${HOME?}/$CONFIG_FILE" \
|
test -w "${HOME?}/$CONFIG_FILE" \
|
||||||
&& mv "${HOME?}/$CONFIG_FILE" "${HOME?}/$CONFIG_FILE.uninstall" \
|
&& mv "${HOME?}/$CONFIG_FILE" "${HOME?}/$CONFIG_FILE.uninstall" \
|
||||||
&& echo -e "\033[0;32mMoved your ${HOME?}/$CONFIG_FILE to ${HOME?}/$CONFIG_FILE.uninstall.\033[0m"
|
&& printf '\e[0;32m%s\e[0m\n' "Moved your ~/$CONFIG_FILE to ~/$CONFIG_FILE.uninstall."
|
||||||
else
|
else
|
||||||
test -w "${HOME?}/$BACKUP_FILE" \
|
test -w "${HOME?}/$BACKUP_FILE" \
|
||||||
&& cp -a "${HOME?}/$BACKUP_FILE" "${HOME?}/$CONFIG_FILE" \
|
&& cp -a "${HOME?}/$BACKUP_FILE" "${HOME?}/$CONFIG_FILE" \
|
||||||
&& rm "${HOME?}/$BACKUP_FILE" \
|
&& rm "${HOME?}/$BACKUP_FILE" \
|
||||||
&& echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m"
|
&& printf '\e[0;32m%s\e[0m\n' "Your original ~/$CONFIG_FILE has been restored."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
printf '\n\e[0;32m%s\e[0m\n\n' "Uninstallation finished successfully! Sorry to see you go!"
|
||||||
echo -e "\033[0;32mUninstallation finished successfully! Sorry to see you go!\033[0m"
|
printf '%s\n' "Final steps to complete the uninstallation:"
|
||||||
echo ""
|
printf '\t%s\n' "-> Remove the ${BASH_IT//${HOME?}/\~} folder"
|
||||||
echo "Final steps to complete the uninstallation:"
|
printf '\t%s\n' "-> Open a new shell/tab/terminal"
|
||||||
echo " -> Remove the $BASH_IT folder"
|
|
||||||
echo " -> Open a new shell/tab/terminal"
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue