Files
ben.de-roo.org/install/script.sh
2026-02-21 13:38:48 +01:00

47 lines
1.2 KiB
Bash

#!/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 pychat
echo "Installation complete."
echo "Start the server with: cd pychat"
echo "python3 server.py"
echo
echo "Start the client with: cd pychat"
echo "python3 client.py"
echo
echo "there is also a beta test client, (not functional) with a better ui."
echo "start the beta client with: cd pychat"
echo "python3 clientBeta.py"