Files
big-bear-scripts-bigbeartec…/check-if-docker-is-running-on-snap/run.sh
Christopher 222e6af258 🔧 refactor: Use #!/usr/bin/env bash in all shell scripts (#16)
This commit refactors all the shell scripts to use `#!/usr/bin/env bash` instead of `#!/bin/bash`. This change ensures that the scripts will run with the system's default Bash interpreter, even if it is not located at the standard `/bin/bash` path.
2024-10-23 13:32:15 -05:00

27 lines
710 B
Bash

#!/usr/bin/env bash
# Function to ask for user confirmation
confirm() {
while true; do
read -rp "$1 [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) return 1 ;;
*) echo "Please answer yes or no." ;;
esac
done
}
# Check if Docker is installed via Snap
if snap list docker &> /dev/null; then
echo "Docker is installed via Snap."
if confirm "Do you want to uninstall the Snap version of Docker?"; then
echo "Uninstalling Docker from Snap..."
sudo snap remove docker
else
echo "Skipping Docker uninstallation from Snap."
fi
else
echo "Docker is not installed via Snap, or Snap is not installed."
fi