Jump to content

My working unattended ISO build script


Andreas T

Recommended Posts

I just thought it might be a good idea to share my build script, centered around a slightly modified HFSLIP version 1.7.8 script, that I use to generate my ISO image for Windows XP Professional 32-bit up-to-date as of 2008-09-27 (excludes Windows Search 4.0 (what were they (Microsoft) thinking?) and Microsoft Silverlight 1.0 plus KB938127 which was slipstreamed but did not stick) with DriverPacks 8.05 and many common run-times and components.

The aim of the generated ISO is for it to be a universal Windows XP Professional DVD (sorry it's too big for a CD) that installs to the destination drive and never needs to refer back to the source disc once it has been installed. (Optical media is just too slow and fiddly for my liking.)

The ISO builds unattended but Windows itself does not install unattended (but there's no reason why it could not be customized so that it does).

NOTE: Initial login will be slow and may appear to have hung as some run-times and components are being silently installed. Once logged in, reboot to finalize installation.

All files unless otherwise specified live in the HFSLIP folder and have been built and tested under Windows XP Professional using Microsoft Virtual PC 2007 (in fact, the generated ISO has built-in support for this virtual machine by installing its Virtual Machine Additions if it is installed under VPC 2007). It has also been tested on one of my physical machines.

Enough of the introduction. I'll let the code do the talking instead...

OK, not code as such, but here's the first file "___README___.txt"...

Please note that "DriverPacks", as used by the unattended scripts (and consequently the build scripts), uses a fixed path to HFSLIP's SOURCESS folder. This path is defined by the "location" variable in DriverPacks' ini-file. This path must be correct before running any of the scripts.

Please also note that the HFSLIP folder-path should not contain spaces or any exotic characters.

There are two ways to build, both which are completely unattended. The first is by using "__BUILD.cmd"...

call HFSLIP_Unattended.cmd

The second way to build is by using "__BUILD_AND_NOTIFY.cmd"...

call HFSLIP_Unattended.cmd

:loop
call Beep.cmd
goto :loop

Please note that "__BUILD_AND_NOTIFY.cmd" must be terminated manually or you'll go bananas listening to the beep, which, by the way, is generated by "Beep.cmd"...

@echo off
mplay32.exe /play /close C:\Windows\Media\ringin.wav

Here's the file common to both build scripts, i.e., "HFSLIP_Unattended.cmd"...

rem @echo off

set HFSLIP_UnattendedLog=HFSLIP_Unattended.log
del /f %HFSLIP_UnattendedLog% > nul 2>&1

echo HFSLIP_Unattended_Before.cmd started at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1
call HFSLIP_Unattended_Before.cmd >> %HFSLIP_UnattendedLog% 2>&1
echo HFSLIP_Unattended_Before.cmd completed at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1

set NOPAUSE=1
set MAKENOISO=1
set AHTEST=I HAVE READ THE INSTRUCTIONS

echo HFSLIP.cmd started at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1
cmd /c HFSLIP.cmd 1 >> %HFSLIP_UnattendedLog% 2>&1
echo HFSLIP.cmd completed at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1

echo HFSLIP_Unattended_After.cmd started at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1
call HFSLIP_Unattended_After.cmd >> %HFSLIP_UnattendedLog% 2>&1
echo HFSLIP_Unattended_After.cmd completed at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1

set MAKENOISO=
set AHTEST=MAKEISO

echo HFSLIP.cmd started at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1
cmd /c HFSLIP.cmd 1 >> %HFSLIP_UnattendedLog% 2>&1
echo HFSLIP.cmd completed at %date% %time% >> %HFSLIP_UnattendedLog% 2>&1

set AHTEST=
set MAKENOISO=
set NOPAUSE=

This executes "HFSLIP_Unattended_Before.cmd"...

rem @echo off
rmdir /s /q SOURCE
mkdir SOURCE
xcopy /e /v /q /h /k "SOURCE.base" SOURCE

Followed by "HFSLIP.cmd"...

@echo off
call hfslip-1.7.8.cmd

And finally "HFSLIP_Unattended_After.cmd"...

rem @echo off
call DriverPacks_Unattended.cmd
mkdir $OEM$
mkdir $OEM$\$$
mkdir $OEM$\$$\Source
xcopy /e /v /q /h /k SOURCESS $OEM$\$$\Source
move $OEM$ SOURCESS

The main guts of it all takes place in the all famous "hfslip-1.7.8.cmd", except that mine is slightly modified to handle my unattended requirements (please let me know if there's a better way). Don’t worry, I'm not going to post the whole code here, just the differences (using the standard diff format) between the original and mine (please note that the first difference is minor and optional, but I think it to be useful for debugging)...

Left file: hfslip-1.7.8.orig.cmd     Right file: hfslip-1.7.8.cmd
1c1
< @ECHO OFF
---
> rem @ECHO OFF
42c42
< PAUSE
---
> CALL :PAUSE
71c71
< PAUSE
---
> CALL :PAUSE
97c97
< PAUSE
---
> CALL :PAUSE
123c123
< PAUSE
---
> CALL :PAUSE
178a179
> IF /I "%NOPAUSE%"=="1" GOTO :BINCOMPSLICE
214a216
> IF /I "%NOPAUSE%"=="1" GOTO :DELCATS
550c552
< CALL :TIMECALC&PAUSE&EXIT
---
> CALL :TIMECALC&CALL :PAUSE&EXIT
2927c2929
< ECHO you use one that hasn't been patched before.&ECHO.&PAUSE
---
> ECHO you use one that hasn't been patched before.&ECHO.&CALL :PAUSE
3203c3205
< IF /I "%AHTEST%"=="MAKEISO" IF EXIST SOURCESS CALL :MAKEISO&PAUSE&EXIT
---
> IF /I "%AHTEST%"=="MAKEISO" IF EXIST SOURCESS CALL :MAKEISO&CALL :PAUSE&EXIT
4268a4271,4275
> :PAUSE
> IF /I "%NOPAUSE%"=="1" GOTO :EOF
> PAUSE
> GOTO :EOF

The same as above but expressed in Beyond Compare 2 XML format (because, XML is, apparently, more "readable")...

<bcreport created="28/09/2008 12:57:25 p.m.">
<ltpath></ltpath>
<rtpath></rtpath>
<filecomparison created="28/09/2008 12:57:25 p.m.">
<filename1>hfslip-1.7.8.orig.cmd</filename1>
<filename2>hfslip-1.7.8.cmd</filename2>
<linecomp status="different">
<text ltid="1">@ECHO OFF</text>
<text rtid="1">rem @ECHO OFF</text>
</linecomp>
<linecomp status="different">
<text ltid="42">PAUSE</text>
<text rtid="42">CALL :PAUSE</text>
</linecomp>
<linecomp status="different">
<text ltid="71">PAUSE</text>
<text rtid="71">CALL :PAUSE</text>
</linecomp>
<linecomp status="different">
<text ltid="97">PAUSE</text>
<text rtid="97">CALL :PAUSE</text>
</linecomp>
<linecomp status="different">
<text ltid="123">PAUSE</text>
<text rtid="123">CALL :PAUSE</text>
</linecomp>
<linecomp status="rtonly">
<text rtid="179">IF /I "%NOPAUSE%"=="1" GOTO :BINCOMPSLICE</text>
</linecomp>
<linecomp status="rtonly">
<text rtid="216">IF /I "%NOPAUSE%"=="1" GOTO :DELCATS</text>
</linecomp>
<linecomp status="different">
<text ltid="550">CALL :TIMECALC&PAUSE&EXIT</text>
<text rtid="552">CALL :TIMECALC&CALL :PAUSE&EXIT</text>
</linecomp>
<linecomp status="different">
<text ltid="2927"> ECHO you use one that hasn't been patched before.&ECHO.&PAUSE</text>
<text rtid="2929"> ECHO you use one that hasn't been patched before.&ECHO.&CALL :PAUSE</text>
</linecomp>
<linecomp status="different">
<text ltid="3203">IF /I "%AHTEST%"=="MAKEISO" IF EXIST SOURCESS CALL :MAKEISO&PAUSE&EXIT</text>
<text rtid="3205">IF /I "%AHTEST%"=="MAKEISO" IF EXIST SOURCESS CALL :MAKEISO&CALL :PAUSE&EXIT</text>
</linecomp>
<linecomp status="rtonly">
<text rtid="4271">:PAUSE</text>
</linecomp>
<linecomp status="rtonly">
<text rtid="4272">IF /I "%NOPAUSE%"=="1" GOTO :EOF</text>
</linecomp>
<linecomp status="rtonly">
<text rtid="4273">PAUSE</text>
</linecomp>
<linecomp status="rtonly">
<text rtid="4274">GOTO :EOF</text>
</linecomp>
</filecomparison>
</bcreport>

That leaves us with one file left, i.e., "DriverPacks_Unattended.cmd"...

rem @echo off

set DriverPacks_Dir=DriverPacks\DPs_BASE_805
set DriverPacks_INI=DPs_BASE.ini
set DriverPacks_UnattendedINI=DPs_BASE_NOGUI.ini

del /f %DriverPacks_Dir%\%DriverPacks_UnattendedINI% > nul 2>&1
call :CreateUnattendedINI
%DriverPacks_Dir%\DPs_BASE.exe /settings:%DriverPacks_UnattendedINI%
del /f %DriverPacks_Dir%\%DriverPacks_UnattendedINI% > nul 2>&1

set DriverPacks_Dir=
set DriverPacks_INI=
set DriverPacks_UnattendedINI=

goto :end

:CreateUnattendedINI
for /f "delims=" %%a in (%DriverPacks_Dir%\%DriverPacks_INI%) do (
call :ProcessLine "%%a"
)
goto :eof

:ProcessLine
set LINE=%~1
if /i "%LINE%"=="GUI = "yes"" set LINE=GUI = "no"
echo %LINE%>>%DriverPacks_Dir%\%DriverPacks_UnattendedINI%
goto :eof

:end

Of course, it goes without saying that the "DriverPacks"\DPs_BASE_805" folder contains the files installed by "DPs_BASE_805.exe" plus **all** official DriverPacks.

Then there is the all-important "HFANSWER.INI" (which resides under "HFTOOLS")...

DRIVERCOMP=
SBOOTPATH=
MBOOTPATH=
DELCATS=
BACKUPSOURCE=
NOLOGCOPY=

ISONAME=
ISOTITLE=HFSLIP
FORCECDIMAGE=1
;CDIMGSW=-h -j1 -m
CDIMGSW=-h -j1 -x -ocis -w3 -m
MKISSW=-relaxed-filenames -d -D -N -J -no-emul-boot -no-iso-translate -boot-load-size 4 -duplicates-once
;MAKENOISO=
OVERWRITEISO=

IE7BACKUP=
IE7GUILOGON=
IE7SVCPACK=

INCWMPCSKIN=
INCALLSKINS=

XPIZESW=
FORCEXPIZESLIP=

INSTALLRC=1

And we can't forget about "DPs_BASE.ini" (which resides under "DriverPacks\DPs_BASE_805")...

[General]
; preferred language
prefLang = "English"
; yes/no, enable or disable the wizard-style buttons, if not specified: yes
wizardButtons = "yes"
; yes/no, enable or disable the GUI, if not specified: yes
GUI = "yes"


[Settings]
; disc/bartpe/multibootDisc
instPlatform = "disc"
; trailing backslash is allowed, but not necessary
location = "E:\HFSLIP\SOURCESS"
; none/all/select, if select, specify them below, if not specified: all
DriverPacks = "select"
; 1/2, method to install the DriverPacks, if not specified: 2
DPsMethod = "2"
; GUIRunOnce/RunOnceEx/custom, if not specified: GUIRunOnce
finisherMethod = "GUIRunOnce"


; this section is optional!
[OptionalSettings]
; none/all/select/paths/patterns, enable or disable Keep The Drivers (KTD) , if not specified: none
KTD = "all"
; <path>, to specify a custom KTD cache location, if not specified: default (%SystemRoot%\DriverPacks)
KTDlocation = "%SystemRoot%\DriverPacks"
; yes/no, enable or disable QuickStream Cache (QSC), if not specified: yes
QSC = "yes"


; you should only add this section if you've set [Settings]\DriverPacks to "select"
[SelectDriverPacks]
DP_Chipset = "yes"
DP_CPU = "yes"
DP_Graphics_A = "yes"
DP_Graphics_B = "yes"
DP_Graphics_C = "yes"
DP_LAN = "yes"
DP_MassStorage = "yes"
DP_Sound_A = "yes"
DP_Sound_B = "yes"
DP_WLAN = "yes"
DP_MassStorage_textmode = "yes"


; this section is optional!
[OptionalSettingsOther]
; CCC/CCP, use ATI Catalyst Control Center or ATI Catalyst Control Panel (only relevant when slipstreaming DriverPack Graphics A)
ATI_cpl = "CCC"

There's also a very important, but simple script called "SetupEx.cmd" which sits under "HFSVCPACK"...

@echo off
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion

rem Set installation source path
REG ADD "%KEY%\Setup" /F /T REG_SZ /V SourcePath /D "%WINDIR%\Source"

Of course, there's more to it than these scripts. For starters, the "SOURCE.base" folder contains a dump of all the files from the original Windows XP Professional SP2 CD. This is done because HFSLIP appears to apply SP3 to "SOURCE" instead of leaving it untouched (but I could be wrong).

This is the log generated by HFLSIP which lists all the remaining files and their locations...

                 This file is automatically generated by HFSLIP
HFSLIP is for personal use only
Copyright© TommyP 2005-2008

============================HOW TO REPORT A PROBLEM============================

If running into problems, refer to [url="http://hfslip.org/support.html"]http://hfslip.org/support.html[/url]

HFSLIP support forum: [url="http://msfn.org/board/index.php?showforum=129"]http://msfn.org/board/index.php?showforum=129[/url]

===============================================================================

Host OS - Windows XP

HFSLIP Version - 1.7.8, build 80614

HFSLIP Path - E:\HFSLIP\

OS in SOURCESS - Windows XP Professional SP3 English
[Service Pack Slipstreamed By HFSLIP]

MSIE Version - MSIE7

Drivers - DRIVER.CAB Updated

CD Install Path - Default

CDTAG - WIN51

===============================================================================
Files in your HF folder:
directx_jun2008_redist.exe
IE7-WindowsXP-KB953838-x86-ENU.exe
IE7-WindowsXP-x86-ENU.exe
WindowsMedia11-KB929399-v2-x86-ENU.exe
WindowsMedia11-KB936782-x86-ENU.exe
WindowsMedia11-KB939683-x86-ENU.exe
WindowsMedia11-KB954154-x86-ENU.exe
WindowsUpdateAgent30-x86.exe
WindowsXP-KB898461-x86-ENU.exe
WindowsXP-KB905474-ENU-x86-Standalone.exe
WindowsXP-KB923789-x86-ENU.exe
WindowsXP-KB936929-SP3-x86-ENU.exe
WindowsXP-KB938127-v2-x86-ENU.exe
WindowsXP-KB938464-x86-ENU.exe
WindowsXP-KB941569-x86-ENU.exe
WindowsXP-KB942288-v3-x86.exe
WindowsXP-KB946648-x86-ENU.exe
WindowsXP-KB950762-x86-ENU.exe
WindowsXP-KB950974-x86-ENU.exe
WindowsXP-KB951066-x86-ENU.exe
WindowsXP-KB951072-v2-x86-ENU.exe
WindowsXP-KB951376-v2-x86-ENU.exe
WindowsXP-KB951698-x86-ENU.exe
WindowsXP-KB951748-x86-ENU.exe
WindowsXP-KB951978-x86-ENU.exe
WindowsXP-KB952287-x86-ENU.exe
WindowsXP-KB952954-x86-ENU.exe
WindowsXP-KB953839-x86-ENU.exe
WMP11-WindowsXP-x86-ENU.exe
X86-all-rootsupd.exe

Files in your HFCABS folder:
ieawsdc.cab
MUAuth.cab
MuCatalogWebControl.cab
muweb_site.cab
OGAControl.cab
opuc4.cab
wbemoc.cab

Files in your HFGUIRUNONCE folder:
010_RogueSpearsRuntimesPart2_1_5_0.exe

Files in your HFSVCPACK folder:
0_RogueSpearsRuntimes_2_8_8.exe
5_RogueSpears_OtherRuntimes_2_5_0.exe
SetupEx.cmd
VirtualMachineAdditions_13_820_silent.exe

Files in your HFSVCPACK_SW1 folder:
WindowsXP-KB951618-v2-x86-ENU.exe

Files in your HFSVCPACK_SW2 folder:

Files in your HFTOOLS folder:
bbie.exe
BOOT.BIN
CDIMAGE.EXE
CDIMAGE.txt
cmdow.exe
CreateurSFX.exe
EXTRACT.EXE
HFANSWER.INI
HFSLIP_POST_getnewfiles_v3.cmd
mkisofs.exe
mkisofs.txt
modifyPE.exe

Files in your REPLACE folder:

===============================================================================
HFSLIP run time: 11m01s

Please note that I used "CreateurSFX.exe" (the "other one" would simply not work) to build "VirtualMachineAdditions_13_820_silent.exe" using the switches "/qn /norestart". I have also renamed Rogue Spear's executables by replacing all in-name dots (".") with underscores ("_") as it makes them more ISO-compliant.

Please also note that I do not include "LegitCheckControl.cab" under "HFCABS" because the latest version of "KB905474" is a replacement for this (and is always up-to-date).

Enjoy,

-Andreas

Edited by Andreas T
Link to comment
Share on other sites


You should use robocopy instead of xcopy.

Your scripts are simple, which is good - but inefficient.

You use rmdir instead of rd - but it's OK, you're young.

But, you have the fatal mistake of assuming that people have the same binaries in their path as you do (mplay32.exe).

My advice, go out and get laid.

Link to comment
Share on other sites

You should use robocopy instead of xcopy.

Your scripts are simple, which is good - but inefficient.

You use rmdir instead of rd - but it's OK, you're young.

But, you have the fatal mistake of assuming that people have the same binaries in their path as you do (mplay32.exe).

My advice, go out and get laid.

First of all, does any of your feedback address the "but inefficient" comment? Either way, efficiency is not an issue as I tend to start a build and "go out and get laid." ;)

About your comments regarding robocopy and mplay32.exe. My aim was to use as little extra tools as possible. That automatically rules out robocopy which is non-standard under Windows XP. However, mplay32.exe on the other hand, is standard. (Yes, I know, I have a few non-standard tools under HFTOOLS, but I've tried to keep them to a minimum.)

Additionally, using rd or rmdir makes no difference, they are in fact identical. (Just run "rd /?" and "rmdir /?" to see that they both mention "each other" in the usage.) In fact, good coding practices state that functions etc., should be descriptive which makes rmdir a better alternative over rd.

Edited by Andreas T
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...