Ver código fonte

Fixes and improvements to installation scripts

- Added comments and explanations
- Added functionality for updating repositories
- Removed automatic creation of superuser
TonyKurts 1 ano atrás
pai
commit
e4b5e807bf
2 arquivos alterados com 64 adições e 10 exclusões
  1. 34 5
      bin/install.bat
  2. 30 5
      bin/install.sh

+ 34 - 5
bin/install.bat

@@ -1,13 +1,42 @@
-git clone -b master http://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git tickets
-git clone -b metasynced_module http://git.sharix-app.org/ShariX_Open/sharix-open-backend.git metaservicesynced
-git clone -b webinterface https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git SharixAdmin/templates/SharixAdmin
+@echo off
 
+REM Function to check if a repository exists and perform git pull or git clone
+:update_repository
+setlocal
+set "repo_url=%~1"
+set "repo_dir=%~2"
+set "repo_branch=%~3"
+
+if exist "%repo_dir%" (
+    rem If the directory exists, then do a git pull
+    echo Updating %repo_dir%...
+    cd "%repo_dir%" || exit /b
+    git pull
+    cd ..
+) else (
+    rem If the directory does not exist, then do a git clone
+    echo Cloning %repo_url% into %repo_dir%...
+    git clone -b %repo_branch% %repo_url% %repo_dir%
+)
+endlocal
+
+REM Update repositories
+call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git" "tickets" "master"
+call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git" "metaservicesynced" "metasynced_module"
+call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git" "SharixAdmin\templates\SharixAdmin" "webinterface"
+call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-config.git" "conf" "master"
+
+git pull
+
+REM Create a Python virtual environment and activate it
 python -m venv venv
 .\venv\Scripts\activate
 
+REM Upgrade pip and install requirements
 pip install --upgrade pip
 pip install -r requirements.txt
 
+REM Checking for core/config.py
 if exist core\config.py (
     echo File config.py already created
 ) else (
@@ -15,7 +44,7 @@ if exist core\config.py (
     echo File config.py was successfully created
 )
 
+REM Run Django migrations and other commands
 python manage.py makemigrations SharixAdmin metaservicesynced tickets
 python manage.py migrate
-python manage.py collectstatic -l --no-input
-python manage.py createsuperuser
+python manage.py collectstatic --clear --no-input

+ 30 - 5
bin/install.sh

@@ -1,16 +1,41 @@
 #!/bin/bash
 
-git clone -b master https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git tickets
-git clone -b metasynced_module https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git metaservicesynced
-git clone -b webinterface https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git SharixAdmin/templates/SharixAdmin
-git clone -b master https://git.sharix-app.org/ShariX_Open/sharix-open-config.git conf
+# Function to check if a repository exists and perform git pull or git clone
+update_repository() {
+    local repo_url="$1"
+    local repo_dir="$2"
+    local repo_branch="$3"
 
+    if [ -d "$repo_dir" ]; then
+        # If the directory exists, then do a git pull
+        echo "Updating $repo_dir..."
+        cd "$repo_dir" || exit
+        git pull
+        cd - || exit
+    else
+        # If the directory does not exist, then do a git clone
+        echo "Cloning $repo_url into $repo_dir..."
+        git clone -b "$repo_branch" "$repo_url" "$repo_dir"
+    fi
+}
+
+# Update repositories
+update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git" "tickets" "master"
+update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git" "metaservicesynced" "metasynced_module"
+update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webadmin.git" "SharixAdmin/templates/SharixAdmin" "webinterface"
+update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-config.git" "conf" "master"
+
+git pull
+
+# Create a Python virtual environment and activate it
 python3 -m venv venv
 source venv/bin/activate
 
+# Upgrade pip and install requirements
 pip install --upgrade pip
 pip install -r requirements.txt
 
+# Checking for core/config.py
 if [ -f core/config.py ]; then
     echo "File config.py already created"
 else
@@ -18,9 +43,9 @@ else
     echo "File config.py was successfully created"
 fi
 
+# Run Django migrations and other commands
 python manage.py makemigrations SharixAdmin metaservicesynced tickets
 python manage.py migrate
 python manage.py collectstatic -l --no-input
-python manage.py createsuperuser
 
 #cp conf/sharix_open.service /etc/systemd/system/