Add UnattendSetupEnabled key for enabling\disabling unattended setup without editing rbuild files.

Modifing rbuild files all the time is not handy and slows down build process.


svn path=/trunk/; revision=24095
This commit is contained in:
Saveliy Tretiakov 2006-09-13 12:33:59 +00:00
parent 63142230b2
commit e6c1f9ca4b
3 changed files with 66 additions and 8 deletions

View file

@ -73,7 +73,7 @@ typedef enum _PAGE_NUMBER
HANDLE ProcessHeap;
UNICODE_STRING SourceRootPath;
BOOLEAN IsUnattendedSetup;
BOOLEAN IsUnattendedSetup = FALSE;
LONG UnattendDestinationDiskNumber;
LONG UnattendDestinationPartitionNumber;
LONG UnattendMBRInstallType = -1;
@ -433,7 +433,6 @@ CheckUnattendedSetup(VOID)
if (DoesFileExist(SourcePath.Buffer, L"unattend.inf") == FALSE)
{
DPRINT("Does not exist: %S\\%S\n", SourcePath.Buffer, L"unattend.inf");
IsUnattendedSetup = FALSE;
return;
}
@ -475,6 +474,26 @@ CheckUnattendedSetup(VOID)
return;
}
/* Check if Unattend setup is enabled */
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context))
{
DPRINT("Can't find key 'UnattendSetupEnabled'\n");
SetupCloseInfFile(&UnattendInf);
return;
}
if (!INF_GetData(&Context, NULL, &Value))
{
DPRINT("Can't read key 'UnattendSetupEnabled'\n");
SetupCloseInfFile(&UnattendInf);
return;
}
if (_wcsicmp(Value, L"yes") != 0)
{
DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
SetupCloseInfFile(&UnattendInf);
return;
}
/* Search for 'DestinationDiskNumber' in the 'Unattend' section */
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
{

View file

@ -1,18 +1,31 @@
; Install to \Device\Harddisk0\Partition1\ReactOS
; In order to get unattended setup working:
; 1. Copy unattend.inf.sample to unattend.inf, adjust as needed
; 2. Uncomment the line in bootdata.rbuild to include it into bootcd
[Unattend]
Signature = "$ReactOS$"
; yes - unattend setup enabled
; no - unattend setup disabled
UnattendSetupEnabled = yes
; Install to \Device\Harddisk0\Partition1\ReactOS
DestinationDiskNumber = 0
DestinationPartitionNumber = 1
InstallationDirectory=ReactOS
;MBRInstallType=0 skips MBR installation
;MBRInstallType=1 install MBR on floppy
;MBRInstallType=2 install MBR on hdd
; MBRInstallType=0 skips MBR installation
; MBRInstallType=1 install MBR on floppy
; MBRInstallType=2 install MBR on hdd
MBRInstallType=2
FullName="MyName"
;OrgName="MyOrg"
ComputerName="MYCOMPUTERNAME";
AdminPassword="MyPassword"
; TimeZone is set GMT as default
TimeZoneIndex=85
; enable this setting to disable daylight saving changes
; DisableAutoDaylightTimeSet = 1

View file

@ -1909,6 +1909,31 @@ ProcessUnattendInf(HINF hUnattendedInf)
TCHAR szValue[256];
DWORD LineLength;
if (!SetupFindFirstLine(hUnattendedInf,
_T("Unattend"),
_T("UnattendSetupEnabled"),
&InfContext))
{
DPRINT1("Error: Cant find UnattendSetupEnabled Key! %d\n", GetLastError());
return FALSE;
}
if (!SetupGetStringField(&InfContext,
1,
szValue,
sizeof(szValue) / sizeof(TCHAR),
&LineLength))
{
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
return FALSE;
}
if (_tcscmp(szValue, _T("yes")) != 0)
{
DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n");
return FALSE;
}
if (!SetupFindFirstLine(hUnattendedInf,
_T("Unattend"),
NULL,
@ -1917,7 +1942,8 @@ ProcessUnattendInf(HINF hUnattendedInf)
DPRINT1("Error: SetupFindFirstLine failed %d\n", GetLastError());
return FALSE;
}
do
{
if (!SetupGetStringField(&InfContext,
@ -1994,7 +2020,7 @@ InstallWizard(VOID)
/* Clear setup data */
ZeroMemory(&SetupData, sizeof(SETUPDATA));
hUnattendedInf = SetupOpenInfFileW(L"unattend.inf",
NULL,
INF_STYLE_OLDNT,