-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuup.cmd
129 lines (105 loc) · 4.18 KB
/
uup.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@echo off
rem Generated on 2022-05-08 02:13:12 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 empty, configuring aria2c to not use any proxy.
::
:: 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
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""" %~1
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"
if NOT EXIST %aria2% goto :NO_ARIA2_ERROR
if NOT EXIST %a7z% goto :NO_FILE_ERROR
if NOT EXIST %uupConv% goto :NO_FILE_ERROR
if NOT EXIST ConvertConfig.ini goto :NO_FILE_ERROR
echo Extracting UUP converter...
"%a7z%" -x!ConvertConfig.ini -y x "%uupConv%" >NUL
echo.
echo Retrieving aria2 script for Apps...
"%aria2%" --no-conf --log-level=info --log="aria2_download.log" -o"%aria2Script%" --allow-overwrite=true --auto-file-renaming=false "https://uupdump.net/get.php?id=9e5ce8a6-4c54-4bf2-96df-b1fb41c97ee9&pack=neutral&edition=app&aria2=2"
if %ERRORLEVEL% GTR 0 call :DOWNLOAD_ERROR & exit /b 1
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 Apps files...
"%aria2%" --no-conf --log-level=info --log="aria2_download.log" -x16 -s16 -j25 -c -R -d"%destDir%" -i"%aria2Script%"
if %ERRORLEVEL% GTR 0 call :DOWNLOAD_ERROR & exit /b 1
echo Retrieving aria2 script...
"%aria2%" --no-conf --log-level=info --log="aria2_download.log" -o"%aria2Script%" --allow-overwrite=true --auto-file-renaming=false "https://uupdump.net/get.php?id=9e5ce8a6-4c54-4bf2-96df-b1fb41c97ee9&pack=en-us&edition=core;coren;professional;professionaln&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 call :DOWNLOAD_ERROR & exit /b 1
if EXIST convert-UUP.cmd goto :START_CONVERT
pause
goto :EOF
:START_CONVERT
call convert-UUP.cmd
goto :EOF
:NO_ARIA2_ERROR
echo We couldn't find %aria2% in current directory.
echo.
echo You can download aria2 from:
echo https://aria2.github.io/
echo.
pause
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