install.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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-settings.git" "conf" "master"
  23. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webapp-design-template.git" "design_template" "unstable"
  24. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webservice-running.git" "webservice_running" "unstable"
  25. update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-landing.git" "landing" "landing_module"
  26. git pull
  27. # Create a Python virtual environment and activate it
  28. python3 -m venv venv
  29. source venv/bin/activate
  30. # Upgrade pip and install requirements
  31. pip install --upgrade pip
  32. pip install -r requirements.txt
  33. # Checking for core/settings_vars.py
  34. if [ -f core/settings_vars.py ]; then
  35. echo "File settings_vars.py already exists"
  36. else
  37. cp core/_settings_vars.py core/settings_vars.py
  38. echo "File settings_vars.py was successfully created"
  39. fi
  40. # Run Django migrations and other commands
  41. python manage.py makemigrations SharixAdmin metaservicesynced tickets webservice_running landing
  42. python manage.py migrate
  43. python manage.py collectstatic -l --no-input
  44. #cp conf/sharix_open.service /etc/systemd/system/