FWSUpdates for WPKG on iPasserelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
3.5 KiB

@echo off
SETLOCAL enabledelayedexpansion
SET /A CHANGES=1
reg query "HKLM\Software\FWS\Updates" /v PendingChanges 1>NUL 2>NUL
IF %ERRORLEVEL% EQU 0 FOR /F "tokens=3" %%A IN ('reg query "HKLM\Software\FWS\Updates" /v PendingChanges') DO SET /A CHANGES=%%A
CALL %~dp0\..\lang\en.bat
FOR /F "tokens=3" %%A IN ('reg query "HKLM\System\CurrentControlSet\Control\nls\Language" /v Installlanguage') DO SET LANG=%%A
IF EXIST %~dp0\..\lang\%LANG%.bat CALL %~dp0\..\lang\%LANG%.bat
SET watitle=%L_WINDOW_TITLE%
SET wasig=%L_WINDOW_SIG%
SET walabels=%L_BTN_PREV%;%L_BTN_NEXT%;%L_BTN_OK%;%L_BTN_CANCEL%
SET wabmp=%SystemDrive%\FWSUpdates\assets\img\fws.bmp
SET waico=%SystemDrive%\FWSUpdates\assets\img\fws.ico
SET watext=%L_INITIALIZING_UPDATES%
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB OPEN NOBACK NOCANCEL
SET /A STEP=90/%CHANGES%
SET /A PROGRESS=0
SET watext=%L_CHECKING_INSTALLS%
SET /A CANCEL=0
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE 1
FOR /F "tokens=2" %%A IN ('cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /nonotify /quiet:true /query:I ^| find "ID:" ^| find /V "productkey" ') DO (
SET PACKAGE=%%A
SET watext=%L_INSTALLING_X% !PACKAGE!
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE !PROGRESS!
IF !ERRORLEVEL! EQU 2 goto :cancel
cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /install:!PACKAGE! /nonotify /quiet:true /noreboot /logAppend:true 1>NUL 2>NUL
SET /A PROGRESS=PROGRESS+%STEP%
)
SET watext=%L_CHECKING_UPDATES%
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE %PROGRESS%
FOR /F "tokens=2" %%A IN ('cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /nonotify /quiet:true /query:u /logAppend:true ^| find "ID:" ^| find /V "productkey"') DO (
SET PACKAGE=%%A
SET watext=%L_UPDATING_X% !PACKAGE!
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE !PROGRESS!
IF !ERRORLEVEL! EQU 2 goto :cancel
cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /upgrade:!PACKAGE! /nonotify /quiet:true /noreboot /logAppend:true 1>NUL 2>NUL
SET /A PROGRESS=PROGRESS+%STEP%
)
SET watext=%L_CHECKING_REMOVES%
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE %PROGRESS%
FOR /F "tokens=2" %%A IN ('cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /nonotify /quiet:true /query:r /logAppend:true ^| find "ID:" ^| find /V "productkey"') DO (
SET PACKAGE=%%A
SET watext=%L_REMOVING_X% !PACKAGE!
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE !PROGRESS!
IF !ERRORLEVEL! EQU 2 goto :cancel
cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /remove:!PACKAGE! /nonotify /quiet:true /noreboot /logAppend:true 1>NUL 2>NUL
SET /A PROGRESS=PROGRESS+%STEP%
)
SET watext=%L_SYNCHRONIZING_CHANGES%
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE %PROGRESS%
IF %ERRORLEVEL% EQU 2 goto :cancel
cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /synchronize /nonotify /quiet:true /noreboot /logAppend:true 1>NUL 2>NUL
goto :finish
:cancel
SET watext=%L_CANCELLING_UPDATES%
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB UPDATE 90
goto :finish
:finish
FOR /F %%A IN ('cscript %SystemDrive%\FWSUpdates\repository\wpkg.js /nonotify /quiet:true /query:m /logAppend:true ^| find /V "productkey" ^| find /C "ID:"') DO SET /A CHANGES=%%A
reg add "HKLM\Software\FWS\Updates" /v PendingChanges /t REG_DWORD /d %CHANGES% /f
reg delete "HKLM\Software\FWS\Updates\User" /v RunOnShutdown /f 1>NUL 2>NUL
reg delete "HKLM\Software\FWS\Updates" /v RunOnShutdown /f 1>NUL 2>NUL
start /w %SystemDrive%\FWSUpdates\bin\wizapp.exe PB CLOSE