#!/bin/bash DEFAULT_REPO="https://git.de-roo.org/ben/pychat.git" echo "Thanks for using PyChat!" # Gebruik eerste argument als repo, anders default REPO_URL="${1:-$DEFAULT_REPO}" # Gebruik tweede argument als directory naam, anders afleiden van repo DIR_NAME="${2:-$(basename "$REPO_URL" .git)}" # Controleer of git beschikbaar is if ! command -v git &> /dev/null; then echo "Error: git is not installed." exit 1 fi # Controleer of python beschikbaar is if ! command -v python3 &> /dev/null; then echo "Error: python3 is not installed." exit 1 fi # Check of directory al bestaat if [ -d "$DIR_NAME" ]; then echo "Directory '$DIR_NAME' already exists. Skipping clone." else git clone "$REPO_URL" "$DIR_NAME" || { echo "Git clone failed."; exit 1; } fi echo echo "Don't forget to change IP/port in client.py to connect to the correct server." echo "Edit client using: nano $DIR_NAME/client.py" echo cd "$DIR_NAME" || exit 1 python3 server.py