C++ für x64 beim x86 Download

C++ für x64 beim x86 Download

Postby aker » 01.05.2013, 14:49

Wie ich bereits angemerkt hatte (dieser Thread), lädt wsusou für x86-System auch x64 C++ Installationsdateien herunter.
Der Code, welchen ich damals zur Änderung dieses Verhaltens vorgeschlagen hatte (vgl. trunk r313), war aufgrund der "same day-rule" leider nicht praktikabel.
Das Hauptproblem des damaligen Codes war, dass bei aktivierter Validierung die "same day-rule" dafür sorgte, dass das x64 C++ nicht geladen wurde, falls die x86 Variante in einem vorherigen Durchlauf aktualisiert wurde.

Ich habe mir den alten Code einmal angesehen und einen neuen (hoffentlich sauber arbeitenden) entworfen.
Die Hauptveränderung ist, dass nun die x86 und x64 C++ Hashes in unterschiedlichen Dateien abgelegt werden ("hashes-cpp-x64.txt" und "hashes-cpp-x86.txt"). Die "same day-rule" prüft nun für jede Architektur einzeln, ob die Daten am selben Tag geändert wurden.

Darum hätte ich hier einen neuen Codevorschlag, der den Fehler der alten Variante hoffentlich nicht wiederholt.
Könnte sich jemand den neuen Code bitte ansehen und prüfen, ob dieser nun korrekt arbeitet.

Code: Select all
    rem *** Download installation files for C++ Runtime Libraries ***
    if "%INC_DOTNET%" NEQ "1" goto SkipCPP
    if "%SKIP_DL%"=="1" goto SkipCPP
    set cpparch=
    if /i "%TARGET_ARCH%" == "x64" (
       set cpparch=x64 x86
    ) else (
       set cpparch=x86
    )
    if "%VERIFY_DL%" NEQ "1" goto DownloadCPP
    if not exist ..\client\cpp\nul goto DownloadCPP
    if not exist ..\client\cpp\%TARGET_ARCH%-glb\nul goto DownloadCPP
    if not exist ..\client\bin\%HASHDEEP_EXE% goto NoHashDeep
    echo Verifying integrity of C++ Runtime Libraries' installation files...
    for %%i in (%cpparch%) do (
       if exist ..\client\md\hashes-cpp-%%i.txt (
          pushd ..\client\md
          ..\bin\%HASHDEEP_EXE% -a -l -vv -k hashes-cpp-%%i.txt -r ..\cpp\*_%%i.exe
          if errorlevel 1 (
             popd
             goto IntegrityError
          )
          popd
          echo %DATE% %TIME% - Info: Verified integrity of C++ Runtime Libraries' installation files >>%DOWNLOAD_LOGFILE%
          ) else (
          echo Warning: Integrity database ..\client\md\hashes-cpp-%%i.txt not found.
          echo %DATE% %TIME% - Warning: Integrity database ..\client\md\hashes-cpp-%%i.txt not found >>%DOWNLOAD_LOGFILE%
       )
    )
    :DownloadCPP
    echo Downloading/validating installation files for C++ Runtime Libraries...
    for %%i in (%cpparch%) do (
      for %%i in (..\client\md\hashes-cpp-%%i.txt) do echo _%%~ti | %SystemRoot%\system32\find.exe "_%DATE:~-10%" >nul 2>&1
      if not errorlevel 1 (
        echo Skipping download/validation of %%i C++ Runtime Libraries' installation files due to 'same day' rule.
        echo %DATE% %TIME% - Info: Skipped download/validation of %%i C++ Runtime Libraries' installation files due to 'same day' rule >>%DOWNLOAD_LOGFILE%
      ) else (
        for /F "tokens=1,2 delims=," %%j in (..\static\StaticDownloadLinks-cpp-%%i-glb.txt) do (
          if "%%k" NEQ "" (
            if exist ..\client\cpp\%%k (
              echo Renaming file ..\client\cpp\%%k to %%~nxj...
              ren ..\client\cpp\%%k %%~nxj
              echo %DATE% %TIME% - Info: Renamed file ..\client\cpp\%%k to %%~nxj >>%DOWNLOAD_LOGFILE%
            )
          )
          %WGET_PATH% -N -P ..\client\cpp %%j
          if errorlevel 1 (
            if exist ..\client\cpp\%%~nxj del ..\client\cpp\%%~nxj
            echo Warning: Download of %%j failed.
            echo %DATE% %TIME% - Warning: Download of %%j failed >>%DOWNLOAD_LOGFILE%
          )
          if "%%k" NEQ "" (
            if exist ..\client\cpp\%%~nxj (
              echo Renaming file ..\client\cpp\%%~nxj to %%k...
              ren ..\client\cpp\%%~nxj %%k
              echo %DATE% %TIME% - Info: Renamed file ..\client\cpp\%%~nxj to %%k >>%DOWNLOAD_LOGFILE%
            )
          )
        )
      )
    )
    echo %DATE% %TIME% - Info: Downloaded/validated installation files for C++ Runtime Libraries >>%DOWNLOAD_LOGFILE%
    if "%CLEANUP_DL%"=="0" goto VerifyCPP
    echo Cleaning up client directory for C++ Runtime Libraries...
    for %%a in (%cpparch%) do (
      for /F %%i in ('dir ..\client\cpp /A:-D /B') do (
        %SystemRoot%\system32\find.exe /I "%%i" ..\static\StaticDownloadLinks-cpp-%%a-glb.txt >nul 2>&1
        if errorlevel 1 (
          del ..\client\cpp\%%i
          echo %DATE% %TIME% - Info: Deleted ..\client\cpp\%%i >>%DOWNLOAD_LOGFILE%
        )
      )
    )
    echo %DATE% %TIME% - Info: Cleaned up client directory for C++ Runtime Libraries >>%DOWNLOAD_LOGFILE%
    :VerifyCPP
    if "%VERIFY_DL%"=="1" (
      for %%a in (%cpparch%) do (
        rem *** Verifying digital file signatures for C++ Runtime Libraries' installation files ***
        if not exist ..\bin\sigcheck.exe goto NoSigCheck
        echo Verifying digital file signatures for %%a C++ Runtime Libraries' installation files...
        ..\bin\sigcheck.exe /accepteula -q -u -v ..\client\cpp\*_%%a.exe >"%TEMP%\sigcheck-cpp-%%a.txt"
        for /F "usebackq skip=1 eol=N tokens=1 delims=," %%i in ("%TEMP%\sigcheck-cpp-%%a.txt") do (
          del %%i
          echo Warning: Deleted unsigned file %%i.
          echo %DATE% %TIME% - Warning: Deleted unsigned file %%i >>%DOWNLOAD_LOGFILE%
        )
        if exist "%TEMP%\sigcheck-cpp-%%a.txt" del "%TEMP%\sigcheck-cpp-%%a.txt"
        echo %DATE% %TIME% - Info: Verified digital file signatures for %%a C++ Runtime Libraries' installation files >>%DOWNLOAD_LOGFILE%
        if not exist ..\client\bin\%HASHDEEP_EXE% goto NoHashDeep
        echo Creating integrity database for %%a C++ Runtime Libraries' installation files...
        if not exist ..\client\md\nul md ..\client\md
        pushd ..\client\md
        ..\bin\%HASHDEEP_EXE% -c md5,sha1,sha256 -l -r ..\cpp\*_%%a.exe >hashes-cpp-%%a.txt
        if errorlevel 1 (
          popd
          echo Warning: Error creating integrity database ..\client\md\hashes-cpp-%%a.txt.
          echo %DATE% %TIME% - Warning: Error creating integrity database ..\client\md\hashes-cpp-%%a.txt >>%DOWNLOAD_LOGFILE%
        ) else (
          popd
          echo %DATE% %TIME% - Info: Created integrity database for %%a C++ Runtime Libraries' installation files >>%DOWNLOAD_LOGFILE%
        )
      )
    ) else (
      if exist ..\client\md\hashes-cpp-%%a.txt (
        del ..\client\md\hashes-cpp-%%a.txt
        echo %DATE% %TIME% - Info: Deleted integrity database for %%a C++ Runtime Libraries' installation files >>%DOWNLOAD_LOGFILE%
      )
    )
    :SkipCPP


EDIT: Code angepasst

Viele Grüße
Last edited by aker on 20.05.2013, 10:22, edited 2 times in total.
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker

WSUS Offline Update „Community Edition“
https://gitlab.com/wsusoffline/wsusoffline/-/releases
aker
 
Posts: 3999
Joined: 02.03.2011, 15:32

Re: C++ für x64 beim x86 Download

Postby WSUSUpdateAdmin » 02.05.2013, 08:20

Moin!

aker wrote:[...]Einziger "Schönheitsfehler", der mir auffällt, ist, dass C++ nun wieder in den Unterverzeichnissen "x64-glb" bzw. "x86-glb" gespeichert wird.

Ja, das ist aber leider kein "Schönheitsfehler", weil "x86-glb"-Verzeichnisse für x64-ISO-Images herausgefiltert werden, was für die C++-Runtimes unerwünscht ist.

Ich hatte ja dazu in viewtopic.php?f=3&t=2424&start=10#p7576 schon angemerkt, dass ich an dieser Stelle eher zu Pragmatismus als zu Perfektionismus neige.

Gruß
Torsten
WSUSUpdateAdmin
Administrator
 
Posts: 2245
Joined: 07.07.2009, 14:38

Re: C++ für x64 beim x86 Download

Postby aker » 20.05.2013, 10:22

Code sollte nun auch ohne diese Unterverzeichnisse funktionieren. (Code: s. oben)

Viele Grüße
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker

WSUS Offline Update „Community Edition“
https://gitlab.com/wsusoffline/wsusoffline/-/releases
aker
 
Posts: 3999
Joined: 02.03.2011, 15:32


Return to Download

Who is online

Users browsing this forum: No registered users and 233 guests