173 lines
3.9 KiB
Batchfile
173 lines
3.9 KiB
Batchfile
@echo off
|
|
set W10=c:\TEMP\W10
|
|
set SOURCES=%W10%\sources
|
|
set BOOT=boot.wim
|
|
set IMAGE=install.wim
|
|
set SCRIPT_SETTINGS=scripts\settings.cmd
|
|
set COMPANY_SETTINGS=company\settings.cmd
|
|
|
|
IF %1.==. GOTO USAGE
|
|
|
|
rem ===================
|
|
rem CONFIGFILE CHECK
|
|
rem ===================
|
|
|
|
echo searching for SCRIPT settings ...
|
|
if NOT EXIST %SCRIPT_SETTINGS% (
|
|
echo INFO: config file %SCRIPT_SETTINGS% NOT FOUND
|
|
set LANG=en-US
|
|
) else (
|
|
echo OK. Loading SCRIPT settings ...
|
|
call %SCRIPT_SETTINGS%
|
|
)
|
|
|
|
set support_user=
|
|
set support_password=
|
|
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%
|
|
)
|
|
|
|
echo.
|
|
echo =================================
|
|
echo Copying all data to USB Stick ...
|
|
echo =================================
|
|
echo.
|
|
|
|
set USBDRIVE=%1
|
|
|
|
if /I %USBDRIVE% == C: (
|
|
echo ERROR: cannot use drive %USBDRIVE% !
|
|
exit /b
|
|
)
|
|
|
|
if NOT EXIST %USBDRIVE% (
|
|
echo ERROR: drive %USBDRIVE% not found!
|
|
exit /b
|
|
)
|
|
|
|
echo using drive %USBDRIVE% ...
|
|
|
|
rem =====
|
|
rem MAIN
|
|
rem =====
|
|
|
|
set answer=
|
|
:ask
|
|
set /p answer="BIOS or UEFI setup (B/U)? "
|
|
if /i "%answer:~,1%" EQU "B" (
|
|
echo selected: BIOS
|
|
copy /Y image\autounattend_BIOS_template.xml %USBDRIVE%\autounattend.xml
|
|
GOTO CONT
|
|
)
|
|
if /i "%answer:~,1%" EQU "U" (
|
|
echo selected: UEFI
|
|
copy /Y image\autounattend_UEFI_template.xml %USBDRIVE%\autounattend.xml
|
|
GOTO CONT
|
|
)
|
|
echo Please type B for BIOS or U for UEFI setup.
|
|
goto ask
|
|
:CONT
|
|
|
|
rem ask for user ...
|
|
set MYUSER=testuser
|
|
if "@%support_user%" NEQ "@" (
|
|
set MYUSER=%support_user%
|
|
) else (
|
|
echo.
|
|
set /p MYUSER="Username (%MYUSER%)? "
|
|
)
|
|
echo MYUSER = %MYUSER%
|
|
|
|
rem ask for real name ...
|
|
set MYNAME=Test User
|
|
if "@%support_name%" NEQ "@" (
|
|
set MYNAME=%support_name%
|
|
) else (
|
|
echo.
|
|
set /p MYNAME="Display Name (%MYNAME%)? "
|
|
)
|
|
echo MYNAME = %MYNAME%
|
|
|
|
rem ask for a password ...
|
|
set MYPASS=
|
|
if "@%support_password%" NEQ "@" (
|
|
set MYPASS=%support_password%
|
|
) else (
|
|
echo.
|
|
set /p MYPASS="Password (not set)? "
|
|
)
|
|
echo MYPASS = %MYPASS%
|
|
|
|
echo.
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYUSER___ "%MYUSER%"
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYNAME___ "%MYNAME%"
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYPASS___ "%MYPASS%"
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYLANG___ "%LANG%"
|
|
|
|
if NOT EXIST %SOURCES%\%BOOT% (
|
|
echo DOH! no %BOOT% in [ %SOURCES% ] found
|
|
exit /b
|
|
)
|
|
|
|
if NOT EXIST %SOURCES%\%IMAGE% (
|
|
echo DOH! no %IMAGE% in [ %SOURCES% ] found
|
|
exit /b
|
|
)
|
|
|
|
echo copying all files in [ %W10% ] to drive %USBDRIVE% ...
|
|
robocopy %W10%\ %USBDRIVE% /MIR /256 /NDL /R:10 /J /XX
|
|
|
|
:CONT
|
|
if EXIST tools (
|
|
echo.
|
|
echo copying folder [ tools ] to drive %USBDRIVE% ...
|
|
robocopy tools %USBDRIVE%\tools /COPY:DT /FFT /XO /256 /NJH /NJS /NDL /XF .gitignore
|
|
)
|
|
|
|
if EXIST software (
|
|
echo.
|
|
echo copying folder [ software ] to %USBDRIVE%\tools ...
|
|
robocopy software %USBDRIVE%\tools\software /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL ^
|
|
/XF *.iso /XF *.txt /XF *.cmd /XF *.csv /XF .gitignore /XD .git
|
|
)
|
|
|
|
for %%P in (drivers scripts source optional personal company apps) do (
|
|
if EXIST %%P (
|
|
echo.
|
|
echo copying folder [ %%P ] to %USBDRIVE%\tools ...
|
|
robocopy %%P %USBDRIVE%\tools\%%P /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL /XF .gitignore /XD .git
|
|
)
|
|
)
|
|
|
|
if EXIST %SCRIPT_SETTINGS% (
|
|
echo.
|
|
echo copying settings file to drive %USBDRIVE% ...
|
|
copy /Y %SCRIPT_SETTINGS% %USBDRIVE%\tools\scripts
|
|
)
|
|
|
|
echo.
|
|
echo copying custom setup script to %USBDRIVE% ...
|
|
copy /Y image\CustomSetup.cmd %USBDRIVE%\
|
|
|
|
echo.
|
|
echo putting tools-copy script to %USBDRIVE% ...
|
|
copy /Y image\CopyTools.cmd %USBDRIVE%\
|
|
|
|
echo.
|
|
echo ======
|
|
echo READY.
|
|
echo ======
|
|
|
|
GOTO END
|
|
|
|
:USAGE
|
|
echo "usage: %0 <USBDRIVE>"
|
|
echo.
|
|
|
|
:END
|
|
|