diff --git a/setup.sh b/setup.sh index b5355e1..c8f7463 100644 --- a/setup.sh +++ b/setup.sh @@ -6,6 +6,7 @@ # Variables timezone="America/New_York" sshd_config="/etc/ssh/sshd_config" +docker_installed=false # Function to prompt for hostname prompt_for_hostname() { @@ -48,6 +49,7 @@ install_docker() { systemctl start docker systemctl enable docker echo "Docker installation complete." + docker_installed=true # Set the flag to true } # Function to create a limited user account @@ -63,9 +65,9 @@ create_user_account() { useradd -m -G wheel "$username" echo "$username:$password" | chpasswd echo "User $username created and added to the wheel group." - - # Check if Docker is installed and add the user to the docker group - if command -v docker &> /dev/null; then + + # Add the user to the docker group if Docker is installed + if [ "$docker_installed" = true ]; then usermod -aG docker "$username" echo "User $username added to the docker group." fi