mirror of
https://github.com/slorelee/wimbuilder2.git
synced 2025-05-06 18:25:51 +08:00
support custom workplace (_Factory_, _ISO_)
This commit is contained in:
parent
59590ea43b
commit
194a757795
@ -186,5 +186,13 @@ set "V=%APP_ROOT%\vendor"
|
||||
|
||||
rem mount winre.wim/boot.wim with wimlib, otherwise dism
|
||||
set USE_WIMLIB=0
|
||||
|
||||
if exist UserConfig.cmd call UserConfig.cmd
|
||||
|
||||
set "FACTORY_PATH=%APP_ROOT%\%Factory%"
|
||||
set "ISO_PATH=%APP_ROOT%\%ISO_DIR%"
|
||||
if "[%Factory:~1,1%]"=="[:]" set "FACTORY_PATH=%Factory%"
|
||||
if "[%ISO_DIR:~1,1%]"=="[:]" set "ISO_PATH=%ISO_DIR%"
|
||||
|
||||
goto :EOF
|
||||
|
||||
|
@ -46,7 +46,7 @@ $("#wb_test_cmd").change(function() {
|
||||
});
|
||||
|
||||
function check_iso_template() {
|
||||
var iso_path = eformat('%APP_ROOT%\\_ISO_');
|
||||
var iso_path = eformat('%ISO_PATH%');
|
||||
if (!fso.FolderExists(iso_path)) {
|
||||
fso.CreateFolder(iso_path);
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ set "project_path=%~1"
|
||||
set _WB_WALK_CMD=main.bat
|
||||
call :apply_patch "%project_path%\main.bat"
|
||||
|
||||
if not exist "%_WB_TMP_DIR%\_patches_selected.txt" goto :EOF
|
||||
if not exist "%WB_TMP_PATH%\_patches_selected.txt" goto :EOF
|
||||
|
||||
for /f "usebackq delims=" %%i in ("%_WB_TMP_DIR%\_patches_selected.txt") do (
|
||||
for /f "usebackq delims=" %%i in ("%WB_TMP_PATH%\_patches_selected.txt") do (
|
||||
call :apply_link_patch "%project_path%\%%i"
|
||||
)
|
||||
|
||||
set _WB_WALK_CMD=last.bat
|
||||
for /f "usebackq delims=" %%i in ("%_WB_TMP_DIR%\_patches_selected.txt") do (
|
||||
for /f "usebackq delims=" %%i in ("%WB_TMP_PATH%\_patches_selected.txt") do (
|
||||
call :apply_link_patch "%project_path%\%%i"
|
||||
)
|
||||
|
||||
|
@ -18,13 +18,13 @@ if "x%WB_PROJECT%"=="x" (
|
||||
goto :ON_ERROR
|
||||
)
|
||||
|
||||
if "x%_WB_TMP_DIR%"=="x" (
|
||||
set "_WB_TMP_DIR=%WB_ROOT%\%Factory%\tmp\%WB_PROJECT%"
|
||||
if "x%WB_TMP_PATH%"=="x" (
|
||||
set "WB_TMP_PATH=%FACTORY_PATH%\tmp\%WB_PROJECT%"
|
||||
)
|
||||
|
||||
rem load patches options
|
||||
if exist "%_WB_TMP_DIR%\_patches_opt.bat" (
|
||||
call "%_WB_TMP_DIR%\_patches_opt.bat"
|
||||
if exist "%WB_TMP_PATH%\_patches_opt.bat" (
|
||||
call "%WB_TMP_PATH%\_patches_opt.bat"
|
||||
)
|
||||
|
||||
rem call _CustomISO_
|
||||
@ -70,7 +70,7 @@ if exist "%ISO_DIR%\efi\Microsoft\boot\%EFI_BIN%" (
|
||||
oscdimg.exe -b"%ISO_DIR%\boot\etfsboot.com" -h -l"%WB_ISO_LABEL%" -m -u2 -udfver102 "%ISO_DIR%" "%Factory%\%WB_ISO_NAME%.iso"
|
||||
)
|
||||
echo \033[96mISO Created -* %Factory%\%WB_ISO_NAME%.iso | cmdcolor.exe
|
||||
set "WB_ISO_PATH=%WB_ROOT%\%Factory%\%WB_ISO_NAME%.iso"
|
||||
set "WB_ISO_PATH=%FACTORY_PATH%\%WB_ISO_NAME%.iso"
|
||||
if ERRORLEVEL 1 (
|
||||
set WB_ISO_PATH=
|
||||
echo make boot iso failed.
|
||||
|
@ -47,16 +47,18 @@ set "BUILD_LOGNAME=%BUILD_LOGTIME%_Build[LOG]_%WB_PROJECT%.log"
|
||||
if "x%WB_BASE%"=="x" call :NO_ENV_CONF WB_BASE
|
||||
set _WB_BASE_EXTRACTED=0
|
||||
set "_WB_TAR_DIR=%Factory%\target\%WB_PROJECT%"
|
||||
set "_WB_TMP_DIR=%Factory%\tmp\%WB_PROJECT%"
|
||||
set "_WB_MNT_DIR=%_WB_TAR_DIR%\mounted"
|
||||
|
||||
call :GETNAME "%WB_BASE%"
|
||||
set "_WB_PE_WIM=%_WB_TAR_DIR%\%RET_GETNAME%"
|
||||
set "WB_BASE_PATH=%FACTORY_PATH%\target\%WB_PROJECT%\%RET_GETNAME%"
|
||||
|
||||
call :MKPATH "%Factory%\target\%WB_PROJECT%\"
|
||||
|
||||
rem full path for macro(s)
|
||||
set "_WB_MNT_PATH=%WB_ROOT%\%_WB_MNT_DIR%"
|
||||
set "_WB_TMP_DIR=%WB_ROOT%\%Factory%\tmp\%WB_PROJECT%"
|
||||
rem full path for macro(s) and project(s)
|
||||
set "_WB_MNT_PATH=%FACTORY_PATH%\target\%WB_PROJECT%\mounted"
|
||||
set "WB_TMP_PATH=%FACTORY_PATH%\tmp\%WB_PROJECT%"
|
||||
|
||||
set "WB_PROJECT_PATH=%WB_ROOT%\Projects\%WB_PROJECT%"
|
||||
|
||||
@ -90,8 +92,10 @@ echo.
|
||||
set BUILD_
|
||||
echo.
|
||||
|
||||
rem extract winre.wim from install.wim
|
||||
set "_WB_BASE_WIM=%WB_BASE%"
|
||||
if /i not "%WB_BASE%"=="winre.wim" goto :PHRASE_GETINFO
|
||||
|
||||
rem extract winre.wim from install.wim
|
||||
if "x%WB_SRC%"=="x" (
|
||||
call :cecho ERROR "mount base wim file failed(can't get winre.wim)."
|
||||
call :CLEANUP
|
||||
@ -104,11 +108,11 @@ if not exist "%_WB_PE_WIM%" (
|
||||
call :CLEANUP
|
||||
)
|
||||
set _WB_BASE_EXTRACTED=1
|
||||
set "WB_BASE=%_WB_PE_WIM%"
|
||||
set "_WB_BASE_WIM=%WB_BASE_PATH%"
|
||||
|
||||
:PHRASE_GETINFO
|
||||
call :cecho PHRASE "PHRASE:Get WIM image INFO"
|
||||
for /f "tokens=1,2 delims=:(" %%i in ('DismX /Get-WimInfo /WimFile:"%WB_BASE%" /Index:%WB_BASE_INDEX% /English') do (
|
||||
for /f "tokens=1,2 delims=:(" %%i in ('DismX /Get-WimInfo /WimFile:"%_WB_BASE_WIM%" /Index:%WB_BASE_INDEX% /English') do (
|
||||
if "%%i"=="Architecture " set WB_PE_ARCH=%%j
|
||||
if "%%i"=="Version " set WB_PE_VER=%%j
|
||||
if "%%i"=="ServicePack Build " set WB_PE_BUILD=%%j
|
||||
@ -173,15 +177,12 @@ call :MKPATH "%_WB_PE_WIM%"
|
||||
|
||||
if "%_WB_BASE_EXTRACTED%"=="1" goto :BASE_WIM_PREPARED
|
||||
|
||||
call copy /y "%WB_BASE%" "%_WB_PE_WIM%"
|
||||
call copy /y "%_WB_BASE_WIM%" "%_WB_PE_WIM%"
|
||||
set _WB_BASE_WIM=
|
||||
|
||||
:BASE_WIM_PREPARED
|
||||
|
||||
|
||||
rem export working paths
|
||||
set "WB_TEMP=%_WB_TMP_DIR%"
|
||||
set "WB_TMP=%_WB_TMP_DIR%"
|
||||
|
||||
rem call prepare.bat before mounting
|
||||
if exist "%WB_PROJECT_PATH%\prepare.bat" (
|
||||
call "%WB_PROJECT_PATH%\prepare.bat" :BEFORE_WIM_MOUNT
|
||||
@ -244,7 +245,7 @@ call :cecho PHRASE "%TIMER_END% - Building completed in %TIMER_ELAPSED% seconds.
|
||||
|
||||
if "x%BUILD_LOGNAME%"=="x" goto :EOF
|
||||
if not "x%_WB_EXEC_MODE%"=="x1" goto :EOF
|
||||
pushd "%WB_ROOT%\_Factory_\log\%WB_PROJECT%\"
|
||||
pushd "%FACTORY_PATH%\log\%WB_PROJECT%\"
|
||||
copy /y /b %BUILD_LOGTIME%.log+last_wimbuilder.log "%BUILD_LOGNAME%"
|
||||
popd
|
||||
|
||||
|
@ -33,14 +33,14 @@ goto :OPT_PARSER
|
||||
:END_OPT_PARSER
|
||||
|
||||
cd /d "%~dp0"
|
||||
set TMP_UPT=_Factory_\tmp
|
||||
set "TMP_UPT=%FACTORY_PATH%\tmp"
|
||||
if "x%TMP_UPDATER%"=="x1" goto :UPDATE_MAIN
|
||||
|
||||
if exist "x64\" (
|
||||
rem bin\
|
||||
cd /d "%~dp0..\"
|
||||
) else (
|
||||
rem _Factory_\tmp\
|
||||
rem %FACTORY_PATH%\tmp\
|
||||
cd /d "%~dp0..\..\"
|
||||
set TMP_UPDATER=1
|
||||
)
|
||||
@ -85,13 +85,13 @@ del /f /a /q "%TMP_UPT%\local.md5"
|
||||
del /f /a /q "%TMP_UPT%\remote.md5"
|
||||
del /f /a /q "%TMP_UPT%\fciv.err"
|
||||
|
||||
rem execute _Factory_\tmp\%~nx0
|
||||
rem execute %FACTORY_PATH%\tmp\%~nx0
|
||||
set TMP_UPDATER=1
|
||||
"%TMP_UPT%\%~nx0" %*
|
||||
|
||||
:UPDATE_MAIN
|
||||
|
||||
set "TMP_UPT=%APP_ROOT%\%TMP_UPT%"
|
||||
set "TMP_UPT=%FACTORY_PATH%\tmp"
|
||||
cd /d "%TMP_UPT%"
|
||||
title Updater
|
||||
|
||||
|
@ -7,9 +7,9 @@ if "x%~1"=="x" goto :EOF
|
||||
echo [MACRO]AddDrivers %*
|
||||
|
||||
if "x%ADDDRIVERS_INITED%"=="x" (
|
||||
del /s /a /q "%_WB_TMP_DIR%\_AddDrivers_INF.txt"
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\INF\ >"%_WB_TMP_DIR%\_AddDrivers_INF.txt"
|
||||
rem for /f "usebackq delims=" %%i in ("%_WB_TMP_DIR%\_AddDrivers_INF.txt") do mkdir "%_WB_TMP_DIR%\Windows_INF\%%~nxi"
|
||||
del /s /a /q "%WB_TMP_PATH%\_AddDrivers_INF.txt"
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\INF\ >"%WB_TMP_PATH%\_AddDrivers_INF.txt"
|
||||
rem for /f "usebackq delims=" %%i in ("%WB_TMP_PATH%\_AddDrivers_INF.txt") do mkdir "%WB_TMP_PATH%\Windows_INF\%%~nxi"
|
||||
set ADDDRIVERS_INITED=1
|
||||
)
|
||||
|
||||
@ -45,7 +45,7 @@ if "x%2"=="xDRIVERS" goto :AddDriver_Reg
|
||||
|
||||
rem ==========update filesystem==========
|
||||
if %_AddDriver_Wildcard% EQU 1 goto :END_INF_CHECK
|
||||
findstr /i /c:"%~1" "%_WB_TMP_DIR%\_AddDrivers_INF.txt" >nul
|
||||
findstr /i /c:"%~1" "%WB_TMP_PATH%\_AddDrivers_INF.txt" >nul
|
||||
if not "%errorlevel%"=="0" (
|
||||
echo [INFO] Driver does not exist^(%~1^).
|
||||
goto :EOF
|
||||
|
@ -1,5 +1,3 @@
|
||||
@echo off
|
||||
|
||||
rem MACRO:AddFiles
|
||||
rem analyze syntax, create _AddFiles.txt for wimlib
|
||||
|
||||
@ -18,7 +16,7 @@ rem ; ...
|
||||
rem :end_files
|
||||
|
||||
echo [MACRO]AddFiles %*
|
||||
if "x%_WB_TMP_DIR%"=="x" goto :EOF
|
||||
if "x%WB_TMP_PATH%"=="x" goto :EOF
|
||||
|
||||
if "x%ADDFILES_SYSRES%"=="x" (
|
||||
set ADDFILES_SYSRES=0
|
||||
@ -26,24 +24,24 @@ if "x%ADDFILES_SYSRES%"=="x" (
|
||||
)
|
||||
|
||||
if "x%ADDFILES_INITED%"=="x" (
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\System32\%WB_PE_LANG%\ >"%_WB_TMP_DIR%\_AddFiles_SYSMUI.txt"
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\System32\%WB_PE_LANG%\ >"%WB_TMP_PATH%\_AddFiles_SYSMUI.txt"
|
||||
if "x%WB_PE_ARCH%"=="xx64" (
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\SysWOW64\%WB_PE_LANG%\ >>"%_WB_TMP_DIR%\_AddFiles_SYSMUI.txt"
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\SysWOW64\%WB_PE_LANG%\ >>"%WB_TMP_PATH%\_AddFiles_SYSMUI.txt"
|
||||
)
|
||||
rem *.mun files present from 19H1
|
||||
if %ADDFILES_SYSRES% EQU 1 (
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\SystemResources\ >"%_WB_TMP_DIR%\_AddFiles_SYSRES.txt"
|
||||
wimlib-imagex.exe dir "%WB_SRC%" %WB_SRC_INDEX% --path=\Windows\SystemResources\ >"%WB_TMP_PATH%\_AddFiles_SYSRES.txt"
|
||||
)
|
||||
set ADDFILES_INITED=1
|
||||
)
|
||||
|
||||
if "x%AddFiles_Mode%"=="xbatch" goto :_AppendFiles
|
||||
if "x%AddFiles_Mode%"=="xmerge" goto :_AppendFiles
|
||||
type nul>"%_WB_TMP_DIR%\_AddFiles.txt"
|
||||
type nul>"%WB_TMP_PATH%\_AddFiles.txt"
|
||||
|
||||
:_AppendFiles
|
||||
rem CALL AddFiles.vbs
|
||||
cscript //nologo "%~dp0\AddFiles.vbs" %* "%_WB_TMP_DIR%\_AddFiles.txt"
|
||||
cscript //nologo "%~dp0\AddFiles.vbs" %* "%WB_TMP_PATH%\_AddFiles.txt"
|
||||
|
||||
if "x%AddFiles_Mode%"=="xbatch" goto :EOF
|
||||
if "x%AddFiles_Mode%"=="xmerge" goto :EOF
|
||||
|
@ -36,16 +36,16 @@ Set env = wshShell.Environment("Process")
|
||||
wim_ver = env("WB_PE_VER")
|
||||
wim_lang = env("WB_PE_LANG")
|
||||
|
||||
Dim tmp_dir, txt_sysmui, txt_sysres
|
||||
tmp_dir = env("_WB_TMP_DIR")
|
||||
Dim tmp_path, txt_sysmui, txt_sysres
|
||||
tmp_path = env("WB_TMP_PATH")
|
||||
|
||||
Set f = fso.OpenTextFile(tmp_dir & "\_AddFiles_SYSMUI.txt", ForReading)
|
||||
Set f = fso.OpenTextFile(tmp_path & "\_AddFiles_SYSMUI.txt", ForReading)
|
||||
txt_sysmui = vbCrLf & f.ReadAll() & vbCrLf
|
||||
f.Close()
|
||||
|
||||
txt_sysres = env("ADDFILES_SYSRES")
|
||||
If txt_sysres = "1" Then
|
||||
Set f = fso.OpenTextFile(tmp_dir & "\_AddFiles_SYSRES.txt", ForReading)
|
||||
Set f = fso.OpenTextFile(tmp_path & "\_AddFiles_SYSRES.txt", ForReading)
|
||||
txt_sysres = vbCrLf & f.ReadAll() & vbCrLf
|
||||
f.Close()
|
||||
Else
|
||||
|
@ -1,6 +1,6 @@
|
||||
echo [MACRO]AddFilesByList %1
|
||||
|
||||
set "_add_batch=%_WB_TMP_DIR%\_AddFileList.bat"
|
||||
set "_add_batch=%WB_TMP_PATH%\_AddFileList.bat"
|
||||
|
||||
if 1==1 (
|
||||
echo call AddFiles "%%~0" :end_files
|
||||
|
@ -1,5 +1,5 @@
|
||||
set HasPatch=true
|
||||
find "%~1" "%WB_TEMP%\_patches_selected.txt" 1>nul 2>nul
|
||||
find "%~1" "%WB_TMP_PATH%\_patches_selected.txt" 1>nul 2>nul
|
||||
if %errorlevel% NEQ 0 (
|
||||
set HasPatch=false
|
||||
errno 0
|
||||
|
@ -1,18 +1,16 @@
|
||||
@echo off
|
||||
|
||||
rem MACRO:DoAddFiles
|
||||
rem extract _AddFiles.txt to mounted directory with wimlib
|
||||
|
||||
if "x%_WB_TMP_DIR%"=="x" goto :EOF
|
||||
if "x%WB_TMP_PATH%"=="x" goto :EOF
|
||||
|
||||
if not exist "%_WB_TMP_DIR%\_AddFiles.txt" goto :EOF
|
||||
if not exist "%WB_TMP_PATH%\_AddFiles.txt" goto :EOF
|
||||
|
||||
set "_DEST_DIR=%_WB_MNT_PATH%"
|
||||
if not "x%~1"=="x" set "_DEST_DIR=%~1"
|
||||
set "_DEST_PATH=%_WB_MNT_PATH%"
|
||||
if not "x%~1"=="x" set "_DEST_PATH=%~1"
|
||||
|
||||
rem echo --dest-dir="%_DEST_DIR%"
|
||||
call wimextract "%WB_SRC%" %WB_SRC_INDEX% @"%_WB_TMP_DIR%\_AddFiles.txt" --dest-dir="%_DEST_DIR%" --no-acls --nullglob
|
||||
set _DEST_DIR=
|
||||
call wimextract "%WB_SRC%" %WB_SRC_INDEX% @"%WB_TMP_PATH%\_AddFiles.txt" --dest-dir="%_DEST_PATH%" --no-acls --nullglob
|
||||
set _DEST_PATH=
|
||||
|
||||
type nul>"%_WB_TMP_DIR%\_AddFiles.txt"
|
||||
type nul>"%WB_TMP_PATH%\_AddFiles.txt"
|
||||
set AddFiles_Mode=
|
||||
|
@ -30,7 +30,7 @@ if( $env:APP_ROOT -eq $null){
|
||||
#$VMISOFile="C:\Users\noelBlanc\Documents\wb\Win10XPE\Win10XPE_x64.ISO"
|
||||
break
|
||||
}else{
|
||||
$VMISOFile=join-path $env:APP_ROOT "\_Factory_\BOOTPE.iso"
|
||||
$VMISOFile=join-path $env:FACTORY_PATH "\BOOTPE.iso"
|
||||
}
|
||||
|
||||
if (-not (test-path $VMISOFile)){
|
||||
|
@ -39,8 +39,8 @@ if ERRORLEVEL 1 (
|
||||
echo ERROR:Could not find a registered machine named '%vm%'.
|
||||
goto :ERR_DONE
|
||||
)
|
||||
echo Mount ISO:"%APP_ROOT%\_Factory_\BOOTPE.iso"
|
||||
VBoxManage.exe storageattach "%vm%" --storagectl %stor_dvd% --type dvddrive --medium "%APP_ROOT%\_Factory_\BOOTPE.iso"
|
||||
echo Mount ISO:"%FACTORY_PATH%\BOOTPE.iso"
|
||||
VBoxManage.exe storageattach "%vm%" --storagectl %stor_dvd% --type dvddrive --medium "%FACTORY_PATH%\BOOTPE.iso"
|
||||
VBoxManage.exe startvm "%vm%"
|
||||
if ERRORLEVEL 1 goto :ERR_DONE
|
||||
rem ping -n 3 127.1 1>nul
|
||||
|
Loading…
x
Reference in New Issue
Block a user