[MAIN]
MBR_ORIGINAL=%BOOT_FOLDER_PATH%\original.mbr
MBR_BOOTSECT=%BOOT_FOLDER_PATH%\bootsect.mbr
; Default install path for all platforms
;INSTALL_PATH=boot\altiris\iso
;USE_NATIVE_BCDEDIT=false

[logfile]
file=\autoinst.log
screen=false
severity=d
append=r
processids=mp

[VARIABLES]
MASTER_GUID={e217309d-dead-beef-a315-001372be0d01}
MASTER_GUID2={e217309d-dead-beef-a315-001372be0d02}
;BESRLOR_GUID={7619dcc9-fafe-11d9-b411-000476eba25f}
DESCRIPTION_AUTOMATION=Symantec Deployment Solution Preboot Environment
DESCRIPTION_PRODUCTION=Windows Production Operating System
DESCRIPTION_BOOTMGR=Windows Boot Manager
FORCE=
MBR=
;INSTALL_PATH_NO_DRIVE=
;BCDEDIT_PATH=
;BOOTSECT_PATH=
;BCD_PATH=
;BCD_OPT=
@=[IF_CMDS]



[IF_CMDS]
IF_BOOTDIR=@CMD.EXE|/D /C DIR /b "%INSTALL_PATH%"
IF_BCDSTORE=@CMD.EXE|/D /C DIR /b "%BCD_PATH%"
IF_ANY=ANY
IF_BOOTMGR=BOOTMGR
IF_OSLOADER=OSLOADER
IF_NTLDR=NTLDR
IF_PREBOOTLDR=PREBOOTLDR
IF_PREBOOTOPT=PREBOOTOPT
;IF_RAMDISKOPT=RAMDISKOPT
IF_TIMEOUT=TIMEOUT
;IF_TIMEOUT=/timeout 1
;IF_BOOTSECT=@%BCDEDIT_PATH%|%BCD_OPT% /enum {bootsect}
;IF_BCDEDIT=@CMD.EXE|/D /C DIR /b "%BCDEDIT_PATH%"
IF_BCDEDIT=@CMD.EXE|/D /C DIR /b "%INSTALL_PATH%\bcdedit.exe"



[NON_COMPATIBLE_MBR]
HP_Recovery=2620490776|0|512
Compaq_NC8430_Recovery=3113582137|0|512

[NOTES]
;[VARIABLES]		contains definitions used elsewhere in this config
;[NON_COMPATIBLE_MBR]   layout is as follows: <MBR description>=<CRC32 hash>|<offset>|<MBR bytes to read>
;[<os>_INSTALL_CMD]     layout is as follows: <id>=<executable>|<parameters>|<step progress by>|<move arrow>
;[<os>_UNINSTALL_CMD]   layout is as follows: <id>=<executable>|<parameters>|<step progress by>|<move arrow>
;  <id> does not have to be unique, as items are not accessed directly, but are enumerated as a list
;  <id> can be in the following format:
;	<if><:<n>>(<val>) [( | or &) <if><:<n>>(<val>)] ...
;	  <if> can be IF, IFNOT, IFEQ, IFNE, IFGT, IFLT, IFGE, IFLE
;		IF - the result must be successful
;		IFNOT - the result must be unsuccessful
;		IFEQ, IFNE, IFGT, IFLT, IFGE, IFLE - the result must "match" the value specified (see below)
;	  <val> can be @<command>, <bcditem>, {<guid>}, [guid], /<item> <value>
;		<command> is an external program to run - indicated by a leading @ symbol
;		<bcditem> is a bcd item to query, and can be ANY, BOOTMGR, NTLDR, OSLOADER, PREBOOTLDR, PREBOOTOPT, RAMDISKOPT, TIMEOUT, BOOTSECT
;		<guid> is a bcd identifier to query - indicated by enclosing { } or [ ] symbols - [ ] symbols are removed, { } are retained
;	    <item> is an item of the {bootmgr} object to examine
;	    <value> is the value the <item> must be compared to
;	  <n> is a value to compare the result to - it is specified by a ":" followed by a numeric value
;[<os>_INSTALL_FILES]   layout is as follows: <sourcefile>=<destfile>|<step progress by>
;[<os>_UNINSTALL_FILES] layout is as follows: <sourcefile>=<destfile>|<step progress by>
;  '-' unconditionally deletes a folder or file
;  '~' deletes a folder only if it is empty


;========================================
; BCD commands

[BCD_BAK_BCDSTORE]
BAK=%BCDEDIT_PATH%|%BCD_OPT% /export "%BOOT_FOLDER_PATH%\bcd.bak"

[BCD_CPY_BCDSTORE]
CPY=CMD.EXE|/D /C COPY "%BCD_PATH%" "%BOOT_FOLDER_PATH%\bcd.bak"|4|1

[BCD_ADD_BCDSTORE]
BCD=CMD.EXE|/D /C ATTRIB "%BCD_PATH%" -h|4|1
BCD=CMD.EXE|/D /C DEL /F "%BCD_PATH%"|4|1
BCD=%BCDEDIT_PATH%|/createstore "%BCD_PATH%"|4|1

[BCD_ADD_BOOTMGR]
BMR=%BCDEDIT_PATH%|%BCD_OPT% /create {%BOOTMGR_TYPE%} /d "%DESCRIPTION_BOOTMGR%"|4
BMR=%BCDEDIT_PATH%|%BCD_OPT% /set {%BOOTMGR_TYPE%} locale en-US|4

[BCD_ADD_NTLDR]
NTL=%BCDEDIT_PATH%|%BCD_OPT% /create {ntldr} /d "%DESCRIPTION_PRODUCTION%"|4
NTL=%BCDEDIT_PATH%|%BCD_OPT% /set {ntldr} path \ntldr|4
NTL=%BCDEDIT_PATH%|%BCD_OPT% /set {ntldr} device boot|4
NTL=%BCDEDIT_PATH%|%BCD_OPT% /default {ntldr}|4
NTL=%BCDEDIT_PATH%|%BCD_OPT% /displayorder {ntldr} /addfirst|4

[BCD_ADD_TIMEOUT]
TMO=%BCDEDIT_PATH%|%BCD_OPT% /timeout 1|4

[BCD_ADD_PREBOOTOPT_NTLDR]
RDO=%BCDEDIT_PATH%|%BCD_OPT% /create %MASTER_GUID2% /device /d "%DESCRIPTION_AUTOMATION%"|4
RDO=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID2% ramdisksdidevice boot|4
RDO=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID2% ramdisksdipath \%INSTALL_PATH_NO_DRIVE%\boot\boot.sdi|4

[BCD_ADD_PREBOOTOPT_BOOTMGR]
RDO=%BCDEDIT_PATH%|%BCD_OPT% /create %MASTER_GUID2% /device /d "%DESCRIPTION_AUTOMATION%"|4
RDO=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID2% ramdisksdidevice partition=%PROD_DRIVE%|4
RDO=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID2% ramdisksdipath \%INSTALL_PATH_NO_DRIVE%\boot\boot.sdi|4

[BCD_ADD_PREBOOTLDR]
OSL=%BCDEDIT_PATH%|%BCD_OPT% /create %MASTER_GUID% /d "%DESCRIPTION_AUTOMATION%" /application OSLOADER|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% device ramdisk=[%BOOT_DEV%]\%INSTALL_PATH_NO_DRIVE%\sources\boot.wim,%MASTER_GUID2%|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% path \windows\system32\boot\winload.%BOOT_LOADER_TYPE%|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% osdevice ramdisk=[%BOOT_DEV%]\%INSTALL_PATH_NO_DRIVE%\sources\boot.wim,%MASTER_GUID2%|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% systemroot \windows|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% winpe yes|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% detecthal yes|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% bootlog yes|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% quietboot yes|4
;OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% sos yes|4
;OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% optionsedit yes|4
;OSL=%BCDEDIT_PATH%|%BCD_OPT% /set %MASTER_GUID% advanced yes|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /displayorder %MASTER_GUID% /addlast|4



[BCD_DEL_BCDSTORE]
BCD=CMD.EXE|/D /C ATTRIB "%BCD_PATH%.log" -h
BCD=CMD.EXE|/D /C DEL /F "%BCD_PATH%.log"
BCD=CMD.EXE|/D /C ATTRIB "%BCD_PATH%" -h
BCD=CMD.EXE|/D /C DEL /F "%BCD_PATH%"
BCD=CMD.EXE|/D /C ATTRIB "%PROD_DRIVE%\bootmgr" -h
BCD=CMD.EXE|/D /C DEL /F "%PROD_DRIVE%\bootmgr"
;@=[BOOTSECT_NT52]

[BCD_DEL_BOOTMGR]
BMR=%BCDEDIT_PATH%|%BCD_OPT% /delete {bootmgr} /cleanup /f|4

[BCD_DEL_NTLDR]
NTL=%BCDEDIT_PATH%|%BCD_OPT% /delete {ntldr} /cleanup /f|4

[BCD_DEL_PREBOOTOPT]
RDO=%BCDEDIT_PATH%|%BCD_OPT% /delete %MASTER_GUID2% /cleanup /f|4

[BCD_DEL_PREBOOTLDR]
;OSL=%BCDEDIT_PATH%|%BCD_OPT% /displayorder %MASTER_GUID% /remove|4
OSL=%BCDEDIT_PATH%|%BCD_OPT% /delete %MASTER_GUID% /cleanup /f|4

[BCD_DEL_TIMEOUT]
;TMO=%BCDEDIT_PATH%|%BCD_OPT% /timeout 1|4



[BOOTSECT_NT60]
BS=%BOOTSECT_PATH%|/nt60 SYS %FORCE% %MBR%|8|1

[BOOTSECT_NT52]
BS=%BOOTSECT_PATH%|/nt52 SYS %FORCE% %MBR%|4|0


;========================================
; Common items

[SETAUTO_CMD]
BSS=%BCDEDIT_PATH%|%BCD_OPT% /bootsequence %MASTER_GUID%

[SETPROD_CMD]
BSD=%BCDEDIT_PATH%|%BCD_OPT% /bootsequence %MASTER_GUID% /remove


;========================================
; ntldr (XP/2003) specific items

[NTLDR]
; Default install path
INSTALL_PATH=%systemdrive%\boot\altiris\iso
USE_NATIVE_BCDEDIT=false

[NTLDR_INSTALL_FILES]
;SRC=location of files unpacked from installer package (in temp dir)
;DST=location to install to (c:\boot\altiris\iso)
%SRC%\autoinst.exe=%DST%\autoinst.exe|5
%SRC%\autoinst.ini=%DST%\autoinst.ini|0
%SRC%\autoutil.exe=%DST%\autoutil.exe|3
%SRC%\autoutil.ini=%DST%\autoutil.ini|3
%SRC%\bcdedit.exe=%DST%\bcdedit.exe|3
%SRC%\bootsect.exe=%DST%\bootsect.exe|3
%DST%\bootmgr=%PROD_DRIVE%\bootmgr|3

[NTLDR_INSTALL_CMD]
;IFNOT(%IF_BOOTDIR%)=CMD.EXE|/D /C MD "%INSTALL_PATH%"
;IF(%IF_BCDSTORE%)=[BCD_CPY_BCDSTORE]
IFNOT(%IF_BCDSTORE%)|IFNOT(%IF_ANY%)=[BCD_ADD_BCDSTORE]
IFNOT(%IF_BOOTMGR%)=[BCD_ADD_BOOTMGR]
IFNOT(%IF_NTLDR%)=[BCD_ADD_NTLDR]
IFNOT(%IF_PREBOOTOPT%)=[BCD_ADD_PREBOOTOPT_NTLDR]
IFNOT(%IF_PREBOOTLDR%)=[BCD_ADD_PREBOOTLDR]
IFNOT(%IF_TIMEOUT%)=[BCD_ADD_TIMEOUT]
IF(%IF_BOOTMGR%)&IF(%IF_NTLDR%)&IF(%IF_PREBOOTOPT%)&IF(%IF_PREBOOTLDR%)=[BOOTSECT_NT60]

[NTLDR_UNINSTALL_FILES]
%INSTALL_PATH%\=-|5|1
%PROD_DRIVE%\atrsboot=-|5
%PROD_DRIVE%\boot\atrsboot=-|5
%PROD_DRIVE%\boot\original.mbr=-
%PROD_DRIVE%\boot\bootsect.mbr=-
%PROD_DRIVE%\boot\altiris\=-|5
%PROD_DRIVE%\boot\=~
;%PROD_DRIVE%\bootmgr=-|10

[NTLDR_UNINSTALL_CMD]
IF(%IF_PREBOOTOPT%)=[BCD_DEL_PREBOOTOPT]
IF(%IF_PREBOOTLDR%)=[BCD_DEL_PREBOOTLDR]
IF(%IF_NTLDR%)&IFNOT(%IF_OSLOADER%)=[BCD_DEL_NTLDR]
;IF(%IF_TIMEOUT%)=[BCD_DEL_TIMEOUT]
IF(%IF_BOOTMGR%)&IFNOT(%IF_OSLOADER%)&IFNOT(%IF_LEGACY%)=[BCD_DEL_BOOTMGR]
IF(%IF_BCDEDIT%)&IFNOT(%IF_ANY%)=[BCD_DEL_BCDSTORE]
IF(%IF_BCDEDIT%)&IFNOT(%IF_ANY%)=[BOOTSECT_NT52]

[NTLDR_SETAUTO_CMD]
@=[SETAUTO_CMD]

[NTLDR_SETPROD_CMD]
@=[SETPROD_CMD]


;========================================
; bootmgr (Vista/2008, Win7/2008R2, Win8/2012) specific items

[BOOTMGR]
; Default install path
INSTALL_PATH=boot\altiris\iso
USE_NATIVE_BCDEDIT=false

[BOOTMGR_INSTALL_FILES]
;SRC=location of files unpacked from installer package (in temp dir)
;DST=location to install to (c:\boot\altiris\iso)
%SRC%\autoinst.exe=%DST%\autoinst.exe|5
%SRC%\autoinst.ini=%DST%\autoinst.ini|0
%SRC%\autoutil.exe=%DST%\autoutil.exe|3
%SRC%\autoutil.ini=%DST%\autoutil.ini|3
%SRC%\bcdedit.exe=%DST%\bcdedit.exe|3

[BOOTMGR_INSTALL_CMD]
;IFNOT(%IF_BOOTDIR%)=CMD.EXE|/D /C MD "%INSTALL_PATH%"
;IF(%IF_BCDSTORE%)=[BCD_BAK_BCDSTORE]
IFNOT(%IF_PREBOOTOPT%)=[BCD_ADD_PREBOOTOPT_BOOTMGR]
IFNOT(%IF_PREBOOTLDR%)=[BCD_ADD_PREBOOTLDR]
IFNOT(%IF_TIMEOUT%)=[BCD_ADD_TIMEOUT]

[BOOTMGR_UNINSTALL_FILES]
%INSTALL_PATH%\=-|5|1
%PROD_DRIVE%\atrsboot=-|5
%PROD_DRIVE%\boot\atrsboot=-|5
%PROD_DRIVE%\boot\original.mbr=-
%PROD_DRIVE%\boot\bootsect.mbr=-
%PROD_DRIVE%\boot\altiris\=-|5
%PROD_DRIVE%\boot\=~

[BOOTMGR_UNINSTALL_CMD]
IF(%IF_PREBOOTOPT%)=[BCD_DEL_PREBOOTOPT]
IF(%IF_PREBOOTLDR%)=[BCD_DEL_PREBOOTLDR]
;IF(%IF_TIMEOUT%)=[BCD_DEL_TIMEOUT]

[BOOTMGR_BCD_UNINSTALL_RESTORE_ORIGINAL_RDO]
; to restore the original ramdiskoptions if they existed prior to the install
RDO=%BCDEDIT_PATH%|%BCD_OPT% /create {ramdiskoptions} /d "%2!s!"
RDO_SDIDEVICE=%BCDEDIT_PATH%|%BCD_OPT% /set {ramdiskoptions} ramdisksdidevice %2!s!
RDO_SDIPATH=%BCDEDIT_PATH%|%BCD_OPT% /set {ramdiskoptions} ramdisksdipath %2!s!

[BOOTMGR_SETAUTO_CMD]
@=[SETAUTO_CMD]

[BOOTMGR_SETPROD_CMD]
@=[SETPROD_CMD]


;========================================
[XP]
/REDIRECT=NTLDR

;========================================
[VISTA]
/REDIRECT=BOOTMGR

;========================================
[WIN7]
/REDIRECT=BOOTMGR

;========================================
[WIN8]
/REDIRECT=BOOTMGR
