1
0

install.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. source bin/install.cfg
  3. # Function to check if a repository exists and perform git pull or git clone
  4. update_repository() {
  5. local repo_url="$1"
  6. local repo_dir="$2"
  7. local repo_branch="$3"
  8. if [ -d "$repo_dir" ]; then
  9. # If the directory exists, then do a git pull
  10. echo "Updating $repo_dir..."
  11. cd "$repo_dir" || exit
  12. git pull
  13. cd - || exit
  14. else
  15. # If the directory does not exist, then do a git clone
  16. echo "Cloning $repo_url into $repo_dir..."
  17. git clone -b "$repo_branch" "$repo_url" "$repo_dir"
  18. fi
  19. }
  20. # Update repositories
  21. update_repository "$TICKETS" "tickets" "master"
  22. update_repository "$BACKEND" "dbsynce" "metasynced_module"
  23. update_repository "$CONFIG" "conf" "master"
  24. update_repository "$DESIGN_TEMPLATE" "design_template" "unstable"
  25. update_repository "$WEBSERVICE_RUNNING" "webservice_running" "unstable"
  26. update_repository "$LANDING" "landing" "landing_module"
  27. update_repository "$USER_MODEL" "user" "master"
  28. update_repository "$WEBAPP_BASE" "design_template" "unstable"
  29. git pull
  30. # Create a Python virtual environment and activate it
  31. python3 -m venv venv
  32. source venv/bin/activate
  33. # Upgrade pip and install requirements
  34. pip install --upgrade pip
  35. pip install -r requirements.txt
  36. # Checking for core/settings_vars.py
  37. if [ -f core/settings_vars.py ]; then
  38. echo "File settings_vars.py already exists"
  39. else
  40. cp core/_settings_vars.py core/settings_vars.py
  41. echo "File settings_vars.py was successfully created"
  42. fi
  43. # Run Django migrations and other commands
  44. python manage.py makemigrations dbsynce tickets webservice_running landing user
  45. python manage.py migrate
  46. python manage.py collectstatic -l --no-input
  47. #cp conf/sharix_open.service /etc/systemd/system/