Yermanusser / Gikde

GNU General Public License v2.0
0 stars 0 forks source link

Work/accessmanager #2

Closed Yermanusser closed 1 year ago

Yermanusser commented 1 year ago

@echo off

rem Generated on 2023-04-26 21:34:14 GMT

:: Proxy configuration

:: If you need to configure a proxy to be able to connect to the internet,

:: then you can do this by configuring the all_proxy environment variable.

:: By default this variable is commented out, configuring aria2c to use

:: the proxy settings specified by the system.

::

:: Usage: set "all_proxy=proxy_address"

:: For example: set "all_proxy=127.0.0.1:8888"

::

:: More information how to use this can be found at:

:: https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-all-proxy

:: https://aria2.github.io/manual/en/html/aria2c.html#environment

:: Uncomment the following line to override the proxy settings specified

:: by the system.

::

:: set "all_proxy="

:: End of proxy configuration

cd /d "%~dp0"

if NOT "%cd%"=="%cd: =%" (

echo Current directory contains spaces in its path.

echo Please move or rename the directory to one not containing spaces.

echo.

pause

goto :EOF

)

if "[%1]" == "[49127c4b-02dc-482e-ac4f-ec4d659b7547]" goto :START_PROCESS

REG QUERY HKU\S-1-5-19\Environment >NUL 2>&1 && goto :START_PROCESS

set command="""%~f0""" 49127c4b-02dc-482e-ac4f-ec4d659b7547

SETLOCAL ENABLEDELAYEDEXPANSION

set "command=!command:'=''!"

powershell -NoProfile Start-Process -FilePath '%COMSPEC%' ^

-ArgumentList '/c """!command!"""' -Verb RunAs 2>NUL

IF %ERRORLEVEL% GTR 0 (

echo =====================================================

echo This script needs to be executed as an administrator.

echo =====================================================

echo.

pause

)

SETLOCAL DISABLEDELAYEDEXPANSION

goto :EOF

:START_PROCESS

set "aria2=files\aria2c.exe"

set "a7z=files\7zr.exe"

set "uupConv=files\uup-converter-wimlib.7z"

set "aria2Script=files\aria2_script.%random%.txt"

set "destDir=UUPs"

powershell -NoProfile -ExecutionPolicy Unrestricted .\files\depends_win.ps1 || (pause & exit /b 1)

echo.

if NOT EXIST ConvertConfig.ini goto :NO_FILE_ERROR

if NOT EXIST %a7z% goto :NO_FILE_ERROR

if NOT EXIST %uupConv% goto :NO_FILE_ERROR

echo Extracting UUP converter...

if NOT EXIST CustomAppsList.txt "%a7z%" -x!ConvertConfig.ini -y x "%uupConv%" >NUL

if EXIST CustomAppsList.txt "%a7z%" -x!ConvertConfig.ini -x!CustomAppsList.txt -y x "%uupConv%" >NUL

echo.

:DOWNLOAD_UUPS

echo Retrieving aria2 script...

"%aria2%" --no-conf --log-level=info --log="aria2_download.log" -o"%aria2Script%" --allow-overwrite=true --auto-file-renaming=false "http://uupdump.net/get.php?id=2bdd2a25-6f99-4fb2-af4a-248e23d34db5&pack=es-mx&edition=core;professional&aria2=2"

if %ERRORLEVEL% GTR 0 call :DOWNLOAD_ERROR & exit /b 1

echo.

for /F "tokens=2 delims=:" %%i in ('findstr #UUPDUMP_ERROR: "%aria2Script%"') do set DETECTED_ERROR=%%i

if NOT [%DETECTED_ERROR%] == [] (

echo Unable to retrieve data from Windows Update servers. Reason: %DETECTED_ERROR%

echo If this problem persists, most likely the set you are attempting to download was removed from Windows Update servers.

echo.

pause

goto :EOF

)

echo Attempting to download files...

"%aria2%" --no-conf --log-level=info --log="aria2_download.log" -x16 -s16 -j5 -c -R -d"%destDir%" -i"%aria2Script%"

if %ERRORLEVEL% GTR 0 goto :DOWNLOAD_UUPS & exit /b 1

if EXIST convert-UUP.cmd goto :START_CONVERT

pause

goto :EOF

:START_CONVERT

call convert-UUP.cmd

goto :EOF

:NO_FILE_ERROR

echo We couldn't find one of needed files for this script.

pause

goto :EOF

:DOWNLOAD_ERROR

echo.

echo We have encountered an error while downloading files.

pause

goto :EOF

:EOF