Fix CRLF line endings for Windows batch files
This commit is contained in:
+29
-29
@@ -1,29 +1,29 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 >nul
|
chcp 65001 >nul
|
||||||
title RIPS Manager - Auto Update
|
title RIPS Manager - Auto Update
|
||||||
|
|
||||||
:: ---- 1. Verificar Python ----
|
:: ---- 1. Verificar Python ----
|
||||||
where python >nul 2>&1
|
where python >nul 2>&1
|
||||||
if %errorlevel% neq 0 (
|
if %errorlevel% neq 0 (
|
||||||
echo Descargando Python 3.12...
|
echo Descargando Python 3.12...
|
||||||
powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-amd64.exe' -OutFile '%TEMP%\python-installer.exe'}"
|
powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-amd64.exe' -OutFile '%TEMP%\python-installer.exe'}"
|
||||||
echo Instalando Python (esperar 1-2 min)...
|
echo Instalando Python (esperar 1-2 min)...
|
||||||
start /wait "" "%TEMP%\python-installer.exe" /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
|
start /wait "" "%TEMP%\python-installer.exe" /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
|
||||||
echo Python instalado. Cerra y abri PowerShell de nuevo.
|
echo Python instalado. Cerra y abri PowerShell de nuevo.
|
||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: ---- 2. Actualizar e instalar deps ----
|
:: ---- 2. Actualizar e instalar deps ----
|
||||||
echo Pull inicial...
|
echo Pull inicial...
|
||||||
git pull
|
git pull
|
||||||
python -m pip install -q -r requirements.txt
|
python -m pip install -q -r requirements.txt
|
||||||
|
|
||||||
:: ---- 3. Arrancar ----
|
:: ---- 3. Arrancar ----
|
||||||
echo.
|
echo.
|
||||||
echo ==========================================
|
echo ==========================================
|
||||||
echo Servidor: http://localhost:8080
|
echo Servidor: http://localhost:8080
|
||||||
echo Auto-update cada 60 segundos
|
echo Auto-update cada 60 segundos
|
||||||
echo Cerra esta ventana para detener
|
echo Cerra esta ventana para detener
|
||||||
echo ==========================================
|
echo ==========================================
|
||||||
python auto_update.py
|
python auto_update.py
|
||||||
|
|||||||
+23
-23
@@ -1,23 +1,23 @@
|
|||||||
import subprocess, threading, time, sys, os
|
import subprocess, threading, time, sys, os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
root = Path(__file__).parent.resolve()
|
root = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
def pull_loop():
|
def pull_loop():
|
||||||
while True:
|
while True:
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(['git', 'pull'], cwd=root, capture_output=True, text=True, timeout=30)
|
r = subprocess.run(['git', 'pull'], cwd=root, capture_output=True, text=True, timeout=30)
|
||||||
if r.stdout.strip():
|
if r.stdout.strip():
|
||||||
print(f"[auto] git pull: {r.stdout.strip()}")
|
print(f"[auto] git pull: {r.stdout.strip()}")
|
||||||
subprocess.run([sys.executable, '-m', 'pip', 'install', '-q', '-r', 'requirements.txt'],
|
subprocess.run([sys.executable, '-m', 'pip', 'install', '-q', '-r', 'requirements.txt'],
|
||||||
cwd=root, capture_output=True, timeout=30)
|
cwd=root, capture_output=True, timeout=30)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[auto] pull error: {e}")
|
print(f"[auto] pull error: {e}")
|
||||||
|
|
||||||
threading.Thread(target=pull_loop, daemon=True).start()
|
threading.Thread(target=pull_loop, daemon=True).start()
|
||||||
os.chdir(root)
|
os.chdir(root)
|
||||||
sys.path.insert(0, str(root))
|
sys.path.insert(0, str(root))
|
||||||
|
|
||||||
import uvicorn, main
|
import uvicorn, main
|
||||||
uvicorn.run('main:app', host='0.0.0.0', port=8080, reload=True)
|
uvicorn.run('main:app', host='0.0.0.0', port=8080, reload=True)
|
||||||
|
|||||||
@@ -1,48 +1,48 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 >nul
|
chcp 65001 >nul
|
||||||
title RIPS Manager - Iniciando...
|
title RIPS Manager - Iniciando...
|
||||||
|
|
||||||
:: Verificar si ya existe Python portable
|
:: Verificar si ya existe Python portable
|
||||||
if exist python\python.exe goto :start
|
if exist python\python.exe goto :start
|
||||||
|
|
||||||
echo ==========================================
|
echo ==========================================
|
||||||
echo Descargando Python portable...
|
echo Descargando Python portable...
|
||||||
echo ==========================================
|
echo ==========================================
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
:: Descargar Python embeddable (64-bit)
|
:: Descargar Python embeddable (64-bit)
|
||||||
powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip' -OutFile 'python.zip'}"
|
powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip' -OutFile 'python.zip'}"
|
||||||
|
|
||||||
if not exist python.zip (
|
if not exist python.zip (
|
||||||
echo ERROR: No se pudo descargar Python
|
echo ERROR: No se pudo descargar Python
|
||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo Extrayendo...
|
echo Extrayendo...
|
||||||
powershell -Command "& {Expand-Archive -Path 'python.zip' -DestinationPath 'python' -Force}"
|
powershell -Command "& {Expand-Archive -Path 'python.zip' -DestinationPath 'python' -Force}"
|
||||||
del python.zip
|
del python.zip
|
||||||
|
|
||||||
:: Habilitar pip (descomentar línea en el archivo de configuración)
|
:: Habilitar pip (descomentar línea en el archivo de configuración)
|
||||||
set PYTHON_EXE=%~dp0python\python.exe
|
set PYTHON_EXE=%~dp0python\python.exe
|
||||||
set PTH_FILE=%~dp0python\python312._pth
|
set PTH_FILE=%~dp0python\python312._pth
|
||||||
powershell -Command "& {(Get-Content '%PTH_FILE%') -replace '#import site','import site' | Set-Content '%PTH_FILE%'}"
|
powershell -Command "& {(Get-Content '%PTH_FILE%') -replace '#import site','import site' | Set-Content '%PTH_FILE%'}"
|
||||||
|
|
||||||
:: Instalar pip
|
:: Instalar pip
|
||||||
echo.
|
echo.
|
||||||
echo Instalando pip...
|
echo Instalando pip...
|
||||||
%PYTHON_EXE% -c "import urllib.request; exec(urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py').read())"
|
%PYTHON_EXE% -c "import urllib.request; exec(urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py').read())"
|
||||||
|
|
||||||
:start
|
:start
|
||||||
echo.
|
echo.
|
||||||
echo Instalando dependencias...
|
echo Instalando dependencias...
|
||||||
python\python.exe -m pip install -q -r requirements.txt 2>nul
|
python\python.exe -m pip install -q -r requirements.txt 2>nul
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ==========================================
|
echo ==========================================
|
||||||
echo Servidor iniciado en http://localhost:8080
|
echo Servidor iniciado en http://localhost:8080
|
||||||
echo Presiona Ctrl+C para detener
|
echo Presiona Ctrl+C para detener
|
||||||
echo ==========================================
|
echo ==========================================
|
||||||
python\python.exe main.py
|
python\python.exe main.py
|
||||||
pause
|
pause
|
||||||
|
|||||||
Reference in New Issue
Block a user