install.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Function to check if a repository exists and perform git pull or git clone
  3. update_repository() {
  4. local repo_url="$1"
  5. local repo_dir="$2"
  6. local repo_branch="$3"
  7. if [ -d "$repo_dir" ]; then
  8. # If the directory exists, then do a git pull
  9. echo "Updating $repo_dir..."
  10. cd "$repo_dir" || exit
  11. git pull
  12. cd - || exit
  13. else
  14. # If the directory does not exist, then do a git clone
  15. echo "Cloning $repo_url into $repo_dir..."
  16. git clone -b "$repo_branch" "$repo_url" "$repo_dir"
  17. fi
  18. }
  19. # Update repositories
  20. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git" "tickets" "master"
  21. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git" "metaservicesynced" "metasynced_module"
  22. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git" "SharixAdmin/templates/SharixAdmin" "webinterface"
  23. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-config.git" "conf" "master"
  24. git pull
  25. # Create a Python virtual environment and activate it
  26. python3 -m venv venv
  27. source venv/bin/activate
  28. # Upgrade pip and install requirements
  29. pip install --upgrade pip
  30. pip install -r requirements.txt
  31. # Checking for core/config.py
  32. if [ -f core/config.py ]; then
  33. echo "File config.py already created"
  34. else
  35. cp core/_config.py core/config.py
  36. echo "File config.py was successfully created"
  37. fi
  38. # Run Django migrations and other commands
  39. python manage.py makemigrations SharixAdmin metaservicesynced tickets
  40. python manage.py migrate
  41. python manage.py collectstatic -l --no-input
  42. #cp conf/sharix_open.service /etc/systemd/system/