w10install/image/finish-boot.cmd
2023-02-20 15:11:28 +01:00

104 lines
2.9 KiB
Batchfile

@echo off
set SOURCES=%SystemDrive%\TEMP\W10\sources
set BOOT=%SystemDrive%\TEMP\BOOT
set SCRIPT_SETTINGS=..\scripts\settings.cmd
set COMPANY_SETTINGS=..\company\settings.cmd
set LANG=en-US
set MYUSER=
set MYNAME=
set MYPASS=
rem ===================
rem CONFIGFILE CHECK
rem ===================
echo searching for SCRIPT settings ...
if NOT EXIST %SCRIPT_SETTINGS% (
echo INFO: config file %SCRIPT_SETTINGS% NOT FOUND
) else (
echo OK. Loading SCRIPT settings ...
call %SCRIPT_SETTINGS%
)
echo searching for COMPANY settings ...
if NOT EXIST %COMPANY_SETTINGS% (
echo INFO: config file %COMPANY_SETTINGS% NOT FOUND
) else (
echo OK. Loading COMPANY settings ...
call %COMPANY_SETTINGS%
)
rem ======
rem MAIN
rem ======
if NOT EXIST %BOOT%\winsetup.exe (
echo renaming Windows setup.exe to boot image ...
move /Y %BOOT%\setup.exe %BOOT%\winsetup.exe
)
echo setting language in boot image ...
dism /image:%BOOT% /Set-InputLocale:%LANG% || exit /b 1
dism /image:%BOOT% /Set-SysLocale:%LANG% || exit /b 1
echo replacing setup.exe with our installer utility ...
copy /Y installer.exe %BOOT%\setup.exe
rem ask for user ...
if "@%localadmin%" NEQ "@" (
set MYUSER=%localadmin%
) else (
echo.
set /p MYUSER="Username (%MYUSER%)? "
)
rem ask for real name ...
if "@%localadmin_name%" NEQ "@" (
set MYNAME=%localadmin_name%
) else (
echo.
set /p MYNAME="Display Name (%MYNAME%)? "
)
rem ask for a password ...
if "@%localadmin_password%" NEQ "@" (
set MYPASS=%localadmin_password%
) else (
echo.
set /p MYPASS="Password (not set)? "
)
echo copying config for unattended install ...
copy /Y autounattend_BIOS_template.xml %BOOT%\autounattend_BIOS.xml
copy /Y autounattend_UEFI_template.xml %BOOT%\autounattend_UEFI.xml
echo.
rem prepare BIOS version ...
..\tools\searchreplace %BOOT%\autounattend_BIOS.xml ___MYUSER___ "%MYUSER%"
..\tools\searchreplace %BOOT%\autounattend_BIOS.xml ___MYNAME___ "%MYNAME%"
..\tools\searchreplace %BOOT%\autounattend_BIOS.xml ___MYPASS___ "%MYPASS%" /S
..\tools\searchreplace %BOOT%\autounattend_BIOS.xml ___MYLANG___ "%LANG%"
echo.
rem prepare UEFI version ...
..\tools\searchreplace %BOOT%\autounattend_UEFI.xml ___MYUSER___ "%MYUSER%"
..\tools\searchreplace %BOOT%\autounattend_UEFI.xml ___MYNAME___ "%MYNAME%"
..\tools\searchreplace %BOOT%\autounattend_UEFI.xml ___MYPASS___ "%MYPASS%" /S
..\tools\searchreplace %BOOT%\autounattend_UEFI.xml ___MYLANG___ "%LANG%"
echo.
if EXIST ..\company\snapshot64.exe (
echo copying LICENSED snapshot64.exe to boot image ...
copy /Y ..\company\snapshot64.exe %BOOT%
) else (
echo copying STANDARD snapshot64.exe to boot image ...
copy /Y ..\software\snapshot64.exe %BOOT%
)
echo copy netuse helper script to boot image ...
copy /Y netuse.cmd %BOOT%
echo unmounting and committing changes to %SOURCES%\boot.wim ...
dism /Unmount-Wim /MountDir:%BOOT% /Commit || exit /b 1