# Ensure that Docker is running...
    docker info > /dev/null 2>&1
    if [ $? -ne 0 ]; then
        echo "Please start Docker and try again."
        exit 1
    fi

# Create new Laravel project
    laravel new sitemap.xml
    cd sitemap.xml

# Remove Laravel's Sail
    sed -i '' '/sail/d' ./composer.json
    rm -r vendor/bin/sail
    rm -r vendor/laravel/sail

# Add modified Sail to composer.json
    composer require --dev stoneplayground/sail
    composer update

#Update variables
    sed -i '' 's/myproject/sitemap.xml/g' ./vendor/stoneplayground/sail/stubs/docker-compose.stub
    sed -i '' 's/myproject/sitemap.xml/g' ./vendor/stoneplayground/sail/bin/sail

# Install Sail
    php ./artisan sail:install --with=mysql,redis,meilisearch,mailhog,selenium

# Update variables
    find . -type f -name '.env' -exec sed -i '' -e 's/APP_NAME=Laravel/APP_NAME=sitemap.xml/g' {} +
    find . -type f -name '.env' -exec sed -i '' -e 's/sitemap.xml.test/sitemap.xml.local/g' {} +
    find . -type f -name '.env' -exec sed -i '' -e '/^APP_URL=.*/a \
    \
    # Sail/Docker\
    APP_SERVICE=sitemap.xml.local' {} +

# Build the docker container
    ./vendor/bin/sail build --no-cache

# Set Terminal Text Colors
    CYAN='\033[0;36m'
    LIGHT_CYAN='\033[1;36m'
    WHITE='\033[1;37m'
    NC='\033[0m'

echo ""

# Set write permissions in vendor subfolder
    cd ./vendor/stoneplayground/sail/.git/objects
    chmod -R +w pack
    cd ../../../../../

# Display next steps
    if sudo -n true 2>/dev/null; then
        sudo chown -R $USER: .
        echo -e "${WHITE}Thank you! We hope you build something incredible."
        echo ""
        echo -e "${WHITE}Don't forget to add the following to your hosts file"
        echo -e "${NC} 127.0.0.1 sitemap.xml.local"
        echo ""
        echo -e "${WHITE}Get started with:${NC} cd sitemap.xml && ./vendor/bin/sail up"
        echo ""
        echo -e "${WHITE}To publish vendor files, type 'php ./artisan vendor:publish'"
    else
        echo -e "${WHITE}Please provide your password so we can make some final adjustments to your application's permissions.${NC}"
        echo ""
        sudo chown -R $USER: .
        echo -e "${WHITE}Thank you! We hope you build something incredible."
        echo ""
        echo -e "${WHITE}Don't forget to add the following to your hosts file"
        echo -e "${NC} 127.0.0.1 sitemap.xml.local"
        echo ""
        echo -e "${WHITE}Dive in with:${NC} cd sitemap.xml && ./vendor/bin/sail up"
        echo ""
        echo -e "${WHITE}To publish vendor files, type 'php ./artisan vendor:publish'"
    fi