#!/bin/sh # Function to check if a command exists command_exists() { command -v "$1" >/dev/null 2>&1 } # Check for Git if ! command_exists git; then echo "Error: Git is not installed. Please install Git and try again." exit 1 fi # Check for Docker if ! command_exists docker; then echo "Error: Docker is not installed. Please install Docker and try again." exit 1 fi # Check for Docker Compose if docker compose version >/dev/null 2>&1; then echo "Docker Compose plugin ('docker compose') is installed." DOCKER_COMPOSE_COMMAND="docker compose" elif command_exists docker-compose; then echo "Standalone Docker Compose ('docker-compose') is installed." DOCKER_COMPOSE_COMMAND="docker-compose" else echo "Error: Neither 'docker compose' nor 'docker-compose' is installed. Please install Docker Compose and try again." exit 1 fi echo "Docker and Docker Compose are installed." ROOT_DIR="$HOME/.dsql" if [ ! -d "$ROOT_DIR" ]; then echo "Creating root directory: $ROOT_DIR" mkdir -p "$ROOT_DIR" fi ADMIN_DIR=$ROOT_DIR/dsql-admin # Function to generate a random string of a given length generate_random_string() { length=$1 tr -dc A-Za-z0-9 .env <