[Main]
Title=PostConfig
Type=script
Level=8
Description=Finalizing VistaPE...
Selected=True
Author=NightMan
Version=12
Contact=vistape@vistape.net
Date=20.07.2008
Locked=false
Download_Level=0
Mandatory=True

[Variables]
%BootTMP%=%TargetDir%\boot.tmp
%MenuFile_GRUB%=%targetdir%\menu.lst

[Process]
ReadENV
#TODO disable this in WB 075 _final_
If,%pCheckBox1%,Equal,True,Run,%ScriptFile%,UnMountWim
IniRead,%VistaInfo%,"VistaInfo","mountprogram","%mountprogram%"
If,"%mountprogram%",Equal,"yes",,FileCreateBlank,"%TargetDir%\vistape.cd"
ShellExecute,Hide,#$q%TargetDir%\Windows\System32\bcdedit.exe#$q,"/store #$q%TargetDir%\boot\bcd#$q /set {default} quietboot on","%WindowsDir%\system32"
#enable ntbtlog.txt
#ShellExecute,Hide,#$q%TargetDir%\Windows\System32\bcdedit.exe#$q,"/store #$q%TargetDir%\boot\bcd#$q /set {default} bootlog on","%WindowsDir%\system32"
If,"%BuildModel%",Equal,"MultiBoot",Run,%ScriptFile%,PackBoot
If,"%BuildModel%",Equal,"RAM",Run,%ScriptFile%,PackBoot
If,"%BuildModel%",Equal,"Normal",Run,%ScriptFile%,NoPackBoot
#If,%pCheckBox2%,Equal,true,Run,%ScriptFile%,PackPrograms
If,ExistFile,"%MenuFile_GRUB%",Run,%ScriptFile%,ConfigureGrub
If,ExistDir,"%TargetDir%\Drivers",Echo,"Creating the driver index for external drivers..."
If,ExistDir,"%TargetDir%\Drivers",ShellExecute,Hide,#$q%Tools%\drv_index.exe#$q,"#$q%TargetDir%\Drivers#$q"

[ConfigureGrub]
Echo,"Configuring Grub4Dos..."
TXTAddLine,"%MenuFile_GRUB%","title Find and Load NTLDR of Windows NT/2K/XP","Append"
TXTAddLine,"%MenuFile_GRUB%","find --set-root /ntldr","Append"
TXTAddLine,"%MenuFile_GRUB%","chainloader /ntldr","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title Find and Load CMLDR of Windows NT/2K/XP","Append"
TXTAddLine,"%MenuFile_GRUB%","find --set-root /cmldr","Append"
TXTAddLine,"%MenuFile_GRUB%","chainloader /cmldr","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title find and load IO.SYS of Windows 9x/Me","Append"
TXTAddLine,"%MenuFile_GRUB%","find --set-root /io.sys","Append"
TXTAddLine,"%MenuFile_GRUB%","chainloader /io.sys","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title find and boot Linux with menu.lst already installed","Append"
TXTAddLine,"%MenuFile_GRUB%","find --set-root /sbin/init","Append"
TXTAddLine,"%MenuFile_GRUB%","configfile /boot/grub/menu.lst","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
#TXTAddLine,"%MenuFile_GRUB%","title MemTest86+","Append"
#TXTAddLine,"%MenuFile_GRUB%","kernel /boot/memtest.bin","Append"
#TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title Floppy (fd0)","Append"
TXTAddLine,"%MenuFile_GRUB%","chainloader (fd0)+1","Append"
TXTAddLine,"%MenuFile_GRUB%","rootnoverify (fd0)","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title CommandLine","Append"
TXTAddLine,"%MenuFile_GRUB%","commandline","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title Reboot","Append"
TXTAddLine,"%MenuFile_GRUB%","reboot","Append"
TXTAddLine,"%MenuFile_GRUB%"," ","Append"
TXTAddLine,"%MenuFile_GRUB%","title Halt","Append"
TXTAddLine,"%MenuFile_GRUB%","halt","Append"
TXTAddLine,"%MenuFile_GRUB%","","Append"

[UnMountWim]
echo,"UnMountig WIM files..."
If,"%WimTools%",Equal,"ImageX",Run,%ScriptFile%,UnMountImagex
If,"%WimTools%",Equal,"WimUtil",Run,%ScriptFile%,UnMountWimutil

[UnMountWimutil]
If,ExistDir,"%BootSRC%\Windows",ShellExecute,Hide,"#$q%tools%\wimutil.exe#$q","unmount #$q%BootSRC%#$q"
If,ExistDir,"%InstallSRC%\Windows",ShellExecute,Hide,"#$q%tools%\wimutil.exe#$q","unmount #$q%InstallSRC%#$q"

[UnMountImagex]
If,ExistDir,"%BootSRC%\Windows",ShellExecute,Hide,"#$q%imagex%#$q","/unmount #$q%BootSRC%#$q"
If,ExistDir,"%InstallSRC%\Windows",ShellExecute,Hide,"#$q%imagex%#$q","/unmount #$q%InstallSRC%#$q"

[PackBoot]
Echo,"Preparing base files with %pScrollBox1% compression..."
ShellExecute,Hide,#$q%TargetDir%\Windows\System32\bcdedit.exe#$q,"/store #$q%TargetDir%\boot\bcd#$q /set {default} device ramdisk=[boot]\vistape.wim#$c{7619dcc8-fafe-11d9-b411-000476eba25f}","%WindowsDir%\system32"
ShellExecute,Hide,#$q%TargetDir%\Windows\System32\bcdedit.exe#$q,"/store #$q%TargetDir%\boot\bcd#$q /set {default} osdevice ramdisk=[boot]\vistape.wim#$c{7619dcc8-fafe-11d9-b411-000476eba25f}","%WindowsDir%\system32"
DirMake,%BootTMP%
If,ExistDir,"%targetdir%\Program#$sFiles",DirMove,"%targetdir%\Program#$sFiles",%BootTMP%
If,ExistDir,"%targetdir%\ProgramData",DirMove,"%targetdir%\ProgramData",%BootTMP%
#DirMove,"%targetdir%\sources",%BootTMP%
#DirMove,"%targetdir%\Users",%BootTMP%
DirMove,"%targetdir%\Windows",%BootTMP%
#add 14.12.2007 for RIS booting
FileCopy,"%targetdir%\BOOTMGR","%BootTMP%\BOOTMGR"
Echo,"Packing boot.wim... it's can take a long time, be patient"
#If,NotExistDir,"%targetdir%\sources",DirMake,"%targetdir%\sources"
If,"%WimTools%",Equal,"ImageX",ShellExecute,Hide,#$q%imagex%#$q,"/capture  #$q%BootTMP%#$q #$q%TargetDir%\vistape.wim#$q #$qVistaPE#$q /boot /COMPRESS %pScrollBox1%"
If,%pScrollBox1%,Equal,maximum,Set,%CM%,lzx
If,%pScrollBox1%,Equal,fast,Set,%CM%,xpress
If,%pScrollBox1%,Equal,none,Set,%CM%,none
If,"%WimTools%",Equal,"WimUtil",ShellExecute,Hide,#$q%Tools%\wimutil.exe#$q,"capture  #$q%BootTMP%#$q #$q%TargetDir%\vistape.wim#$q /%CM%"
DirDelete,"%BootTMP%"

[NoPackBoot]
Echo,"Preparing boot directly from cd..."
ShellExecute,Hide,#$q%TargetDir%\Windows\System32\bcdedit.exe#$q,"/store #$q%TargetDir%\boot\bcd#$q /set {default} device boot","%WindowsDir%\system32"
ShellExecute,Hide,#$q%TargetDir%\Windows\System32\bcdedit.exe#$q,"/store #$q%TargetDir%\boot\bcd#$q /set {default} osdevice boot","%WindowsDir%\system32"

[PackPrograms]
Echo,"Packing programs.wim..."
If,NotExistDir,"%VistaTemp%\Programs",Halt,"Folder %VistaTemp%\Programs not found"
If,NotExistFile,"%VistaTemp%\Programs\program.cd",FileCreateBlank,"%VistaTemp%\Programs\program.cd"
If,"%WimTools%",Equal,"WimUtil",ShellExecute,Hide,#$q%Tools%\wimutil.exe#$q,"capture  #$q%VistaTemp%\Programs#$q #$q%TargetDir%\programs.wim#$q"
If,"%WimTools%",Equal,"ImageX",ShellExecute,Hide,#$q%imagex%#$q,"/capture  #$q%VistaTemp%\Programs#$q #$q%TargetDir%\programs.wim#$q /boot /compress maximum"
FileCopy,"%tools%\wimutil.exe","%VistaTemp%\Windows\System32"
DirDelete,"%VistaTemp%\Programs"

[temp]
pCheckBox2="Pack program.wim (request ramdisk and wim plugins)",1,3,12,60,273,18,False

[Interface]
pCheckBox1="UnMount WIM Files",1,3,10,40,200,18,True
pTextLabel1="WIM compression level",1,1,10,79,115,18,8,Normal
pScrollBox1=maximum,1,4,127,77,150,18,none,fast,maximum

[InterfaceEncoded]

[AuthorEncoded]
VistaPE-11-Small.gif=1Kb,1Kb
Logo=VistaPE-11-Small.gif

[Enc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