Add confirmation prompt before proceeding with

uninstallation
This commit is contained in:
Christopher
2023-11-21 13:51:47 -06:00
parent 339e5c5ea6
commit a9d65aa60d

View File

@@ -6,6 +6,15 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi
# Function to confirm with the user before proceeding
confirm_action() {
read -r -p "$1 Are you sure you want to proceed? (y/N): " response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo "Uninstallation canceled."
exit 1
fi
}
# Stop and remove the Dockge containers
if command -v docker &> /dev/null; then
# Using Docker CE
@@ -20,6 +29,9 @@ else
exit 1
fi
# Confirm with the user before removing the Dockge directories
confirm_action "Removing Dockge directories..."
# Remove the Dockge directories
echo "Removing Dockge directories..."
rm -rf /opt/stacks /opt/dockge