Breakthrough change

This commit is contained in:
2026-11-14 22:12:04 +07:00
parent 65908617c3
commit 1a4774e376
12 changed files with 806 additions and 116 deletions
+63
View File
@@ -0,0 +1,63 @@
@echo off
setlocal EnableDelayedExpansion
:: 0. AUTO-ELEVATE TO ADMINISTRATOR
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Requesting Administrator privileges...
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
set "SCRIPT_DIR=%~dp0"
for %%I in ("%SCRIPT_DIR%..") do set "ROOT_DIR=%%~fI\"
set "WSL_DISTRO=Ubuntu-22.04"
set "PROJECT_DIR=/opt/walmart"
set "KIOSK_APP_DIR=C:\KioskApp"
echo ============================================
echo Updating Walmart containers & Kiosk splash...
echo ============================================
for %%F in ("compose.yml" ".env" "templates\startup.html") do (
if not exist "%ROOT_DIR%%%~F" (
echo [ERROR] Missing required file: "%ROOT_DIR%%%~F"
pause
exit /b 1
)
)
for /f "delims=" %%i in ('wsl -d %WSL_DISTRO% -u root wslpath -a "%ROOT_DIR%"') do set "WSL_ROOT_DIR=%%i"
echo [1/4] Updating config files and Kiosk startup template...
if not exist "%KIOSK_APP_DIR%" mkdir "%KIOSK_APP_DIR%"
copy /Y "%ROOT_DIR%templates\startup.html" "%KIOSK_APP_DIR%\startup.html" >nul
wsl -d %WSL_DISTRO% -u root bash -c "mkdir -p %PROJECT_DIR% && cp '%WSL_ROOT_DIR%/compose.yml' %PROJECT_DIR%/ && cp '%WSL_ROOT_DIR%/.env' %PROJECT_DIR%/"
if %errorLevel% neq 0 (
echo [ERROR] Failed to copy config files into WSL. Is %WSL_DISTRO% installed?
pause
exit /b 1
)
echo [2/4] Pulling latest images...
wsl -d %WSL_DISTRO% -u root bash -c "cd %PROJECT_DIR% && docker compose pull"
if %errorLevel% neq 0 (
echo [ERROR] Failed to pull Docker images. Check Internet or Docker login session.
pause
exit /b 1
)
echo [3/4] Restarting containers...
wsl -d %WSL_DISTRO% -u root bash -c "cd %PROJECT_DIR% && docker compose up -d"
echo [4/4] Cleaning up unused images...
wsl -d %WSL_DISTRO% -u root bash -c "docker image prune -af"
echo.
echo ============================================
echo Walmart update completed!
echo ============================================
wsl -d %WSL_DISTRO% -u root bash -c "docker ps"
pause