Update install/script.sh
This commit is contained in:
@@ -1,47 +1,39 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DEFAULT_REPO="https://git.de-roo.org/ben/pychat.git"
|
BASE_URL="https://git.de-roo.org/ben/pychat/raw/branch/main"
|
||||||
|
INSTALL_DIR="install"
|
||||||
|
|
||||||
echo "Thanks for using PyChat!"
|
echo "Thanks for using PyChat!"
|
||||||
|
|
||||||
# Gebruik eerste argument als repo, anders default
|
# python check
|
||||||
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
|
if ! command -v python3 &> /dev/null; then
|
||||||
echo "Error: python3 is not installed."
|
echo "Error: python3 is not installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check of directory al bestaat
|
# downloader check
|
||||||
if [ -d "$DIR_NAME" ]; then
|
if command -v curl &> /dev/null; then
|
||||||
echo "Directory '$DIR_NAME' already exists. Skipping clone."
|
DL="curl -L -o"
|
||||||
|
elif command -v wget &> /dev/null; then
|
||||||
|
DL="wget -O"
|
||||||
else
|
else
|
||||||
git clone "$REPO_URL" "$DIR_NAME" || { echo "Git clone failed."; exit 1; }
|
echo "Error: curl or wget required."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
mkdir -p "$INSTALL_DIR"
|
||||||
echo "Don't forget to change IP/port in client.py to connect to the correct server."
|
cd "$INSTALL_DIR" || exit 1
|
||||||
echo "Edit client using: nano $DIR_NAME/client.py"
|
|
||||||
echo
|
|
||||||
|
|
||||||
cd pychat
|
# bestanden downloaden
|
||||||
|
$DL server.py "$BASE_URL/server.py"
|
||||||
|
$DL client.py "$BASE_URL/client.py"
|
||||||
|
$DL clientBeta.py "$BASE_URL/clientBeta.py"
|
||||||
|
$DL clientWin.py "$BASE_URL/clientWin.py"
|
||||||
|
$DL passwd.json "$BASE_URL/passwd.json"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Don't forget to change IP/port in client.py."
|
||||||
echo "Installation complete."
|
echo "Installation complete."
|
||||||
echo "Start the server with: cd pychat"
|
echo "Start server: python3 server.py"
|
||||||
echo "python3 server.py"
|
echo "Start client: python3 client.py"
|
||||||
echo
|
echo "Start beta: python3 clientBeta.py"
|
||||||
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"
|
|
||||||
Reference in New Issue
Block a user