Skip to content

Instantly share code, notes, and snippets.

@LoganGray
Last active August 14, 2024 22:27
Show Gist options
  • Save LoganGray/dcfe9ece541d7b30e90c88a9e873aa08 to your computer and use it in GitHub Desktop.
Save LoganGray/dcfe9ece541d7b30e90c88a9e873aa08 to your computer and use it in GitHub Desktop.
#!/bin/bash
# set -x
if [ -n "$SUDO_USER" ]; then
echo "Hello $SUDO_USER!!"
elif [ "$EUID" -eq 0 ]; then
echo "This script should NOT be run as root, please run it as a regular user with sudo."
exit 1
else
echo "Please run as a regular user with sudo."
exit 1
fi
if command -v docker &> /dev/null
then
echo "Docker is installed."
else
echo "Docker is not installed."
read -p "Do you want to install it, via docker.com's get-docker.sh? (Y/n): " answer
case ${answer:0:1} in
n|N )
echo "okey doke! ciao"
;;
* )
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
usermod -aG docker $SUDO_USER
systemctl start docker
;;
esac
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment