opus-nt/patch-iso.bat

132 lines
2.5 KiB
Batchfile
Raw Normal View History

2019-10-06 10:23:05 +00:00
@echo off
setlocal EnableDelayedExpansion
set workdir=%~dp0
2019-10-06 18:55:29 +00:00
set tweakdir=%workdir%tweaks
2019-10-06 10:23:05 +00:00
cd /d %workdir%
:: expanding path with prerequisites
for /d %%i in ("bin\*") do set path=%cd%\%%i;!path!
2019-10-06 10:23:05 +00:00
:: clearing temporary data
if exist "tmp" (
echo.
2019-10-06 18:55:29 +00:00
echo -- unmounting registry --
reg unload HKLM\OPUS-NT_TMP
2019-10-06 10:23:05 +00:00
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- unmounting windows image --
dism /unmount-image /mountdir:"tmp\wim" /discard
2019-10-06 10:23:05 +00:00
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- removing tmp folder --
2019-10-06 10:23:05 +00:00
rmdir "tmp" /s /q
2019-10-08 11:56:08 +00:00
echo.
2019-10-06 10:23:05 +00:00
)
if "%1" == "" (
echo usage: create-iso.bat IMAGE
goto exit
)
:: console mode
if "%1" == "console" (
echo.
cmd
goto exit
)
mkdir tmp
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- extracting iso --
2019-10-06 10:23:05 +00:00
mkdir tmp\disc-image
2019-10-06 18:55:29 +00:00
7z x -o"tmp\disc-image" "%1"
2019-10-06 10:23:05 +00:00
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- mounting wmi --
2019-10-08 11:56:08 +00:00
dism /get-imageinfo /imagefile:"tmp\disc-image\sources\install.wim"
set /p "index=index: "
2019-10-06 10:23:05 +00:00
mkdir tmp\wim
2019-10-08 11:56:08 +00:00
dism /mount-image /index:%index% /imagefile:"tmp\disc-image\sources\install.wim" /mountdir:"tmp\wim"
2019-10-06 10:23:05 +00:00
:: image console mode
if "%2" == "console" (
echo.
cmd
goto exit
)
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- applying files to windows image --
for /d %%t in ("%tweakdir%\*") do (
2019-10-06 18:55:29 +00:00
call "applyTweakWim.bat" "%%t"
2019-10-06 10:23:05 +00:00
)
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- working registry --
for %%r in (tmp\wim\windows\system32\config\*) do (
echo.
echo mounting: %%~nr
reg load HKLM\OPUS-NT_TMP "%%r"
2019-10-06 10:23:05 +00:00
echo.
2019-10-06 18:55:29 +00:00
echo running tweaks for %%~nr...
for /d %%t in ("%tweakdir%\*") do (
2019-10-06 18:55:29 +00:00
call "applyTweakReg.bat" "%%t" "%%r"
2019-10-06 10:23:05 +00:00
)
2019-10-06 18:55:29 +00:00
echo unmounting: %%r
reg unload HKLM\OPUS-NT_TMP
2019-10-06 10:23:05 +00:00
)
:: why would the default user settings not be in %windir%\system32\config?
echo.
2019-10-06 18:55:29 +00:00
echo mounting: tmp\wim\Users\Default\NTUSER.DAT
reg load HKLM\OPUS-NT_TMP "tmp\wim\Users\Default\NTUSER.DAT"
2019-10-06 10:23:05 +00:00
echo running tweaks for NTUSER...
for /d %%t in ("%tweakdir%\*") do (
2019-10-06 18:55:29 +00:00
call "applyTweakReg.bat" "%%t" "NTUSER"
2019-10-06 10:23:05 +00:00
)
2019-10-06 18:55:29 +00:00
echo unmounting: tmp\wim\Users\Default\NTUSER.DAT
reg unload HKLM\OPUS-NT_TMP
2019-10-06 10:23:05 +00:00
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- applying scripts --
for /d %%t in ("%tweakdir%\*") do (
2019-10-06 19:27:14 +00:00
call "applyTweakScript.bat" "%%t"
2019-10-06 10:23:05 +00:00
)
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- committing changes to wim and unmounting --
2019-10-06 10:23:05 +00:00
dism /unmount-image /mountdir:"tmp\wim" /commit
echo.
2019-10-06 18:55:29 +00:00
echo.
echo -- applying files to disc-image --
for /d %%t in ("%tweakdir%\*") do (
2019-10-06 19:27:14 +00:00
call "applyTweakIso.bat" "%%t"
2019-10-06 10:23:05 +00:00
)
echo.
2019-10-06 18:55:29 +00:00
echo -- moving disc-image folder --
2019-10-06 10:23:05 +00:00
rmdir "disc-image" /s /q
move "tmp\disc-image" "%cd%"
echo.
2019-10-06 18:55:29 +00:00
echo -- deleting tmp --
2019-10-06 10:23:05 +00:00
rmdir "tmp" /s /q
echo.
echo all done. a folder with the disc image's data has been created. use something like ntlite to compile it into an iso.
pause
explorer.exe "%cd%\disc-image"
2019-10-06 18:55:29 +00:00
goto exit
2019-10-06 10:23:05 +00:00
:exit