Skip to content

Commit

Permalink
feat: add uninstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
YasminTeles committed Mar 9, 2024
1 parent 5ddf6d2 commit 1c7bdfd
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help del ssh backup
.PHONY: help check_clean del ssh backup

help: ## Show help.
@printf "A set of environment management commands.\n"
Expand All @@ -7,7 +7,10 @@ help: ## Show help.
@printf "\nThe Commands are:\n\n"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\t\033[36m%-30s\033[0m %s\n", $$1, $$2}'

del: ## Delete your development environment.
check_clean:
@echo -n "Are you sure you want to remove all configurations? [y/N] " && read ans && [ $${ans:-N} = y ]

del: check_clean ## Delete your development environment.
@echo "Deleting all dotfiles, applications, and folders..."
@stow --dotfiles -D git ssh brew zsh
@rm -rf ~/Projects
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ These are my dotfiles.
Insert this into a macOS Terminal or Linux shell prompt. The script will detail its actions and then halt before executing them.

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/YasminTeles/dotfiles/HEAD/install.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/YasminTeles/dotfiles/main/install.sh)"
```

## Post-Installation
Expand Down Expand Up @@ -38,6 +38,25 @@ A set of environment management commands is available at `Makefile`. To access t
make help
```

## Uninstalling Environment Configurations

This script is designed to remove all configurations of your environment. **Please proceed with caution** as this action is irreversible.

### Instructions

Enter this command into a macOS Terminal or Linux shell prompt. The script will outline its actions.

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/YasminTeles/dotfiles/main/uninstall.sh)"
```

### Important Notes

> [!CAUTION]
> Ensure you have **backups** of any important configurations before running this script.
By following these steps, you can safely remove all configurations of the environment as needed.

## License

This project is licensed under the [MIT License](LICENSE).
Expand Down
50 changes: 50 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# Tells the shell script to exit if it encounters an error
set -e

# Print a step description
TOTAL_STEPS=5
STEP=1
function step_msg {
printf "\n[$STEP/$TOTAL_STEPS] $1...\n";
((STEP++))
}

echo "This script will remove all configurations of the environment."
read -p "Are you sure you want to proceed? (y/n) " CONFIRM

if [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]]
then
printf "\nPlease wait! Proceeding with the removal of all configurations...\n"

# -- Symlinks ----------------------------------------------------------------
step_msg "Removing all symlinks"
cd ~/.dotfiles && stow --dotfiles -D git ssh brew zsh

# -- Project folder ----------------------------------------------------------
step_msg "Removing the Project directory"
rm -rf ~/Projects

# -- SSH Key -----------------------------------------------------------------
step_msg "Removing SSH Keys"
rm -rf ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub

# -- Productivity Apps -------------------------------------------------------
step_msg "Removing all productivity apps"
rm -rf ~/.oh-my-zsh
brew uninstall --force $(brew list)

# -- Dotfiles ----------------------------------------------------------------
step_msg "Removing Dotfiles directory"
rm -rf ~/.dotfiles

# -- Happy end -----------------------------------------------------------------
printf "\nAll configurations have been removed."

else
printf "\nOperation cancelled."
fi

printf "\nHave a nice day!\n"

0 comments on commit 1c7bdfd

Please sign in to comment.