From 602854999a0b8571ddd1aa30468eb2c74f5a6c03 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 7 Feb 2013 19:25:01 +0000 Subject: [PATCH] Add a script to sub in different mount letters and UEFI/plain partition plans into a unified windows template scheme git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15097 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../xcat/netboot/windows/fixupunattend.vbs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 xCAT-server/share/xcat/netboot/windows/fixupunattend.vbs diff --git a/xCAT-server/share/xcat/netboot/windows/fixupunattend.vbs b/xCAT-server/share/xcat/netboot/windows/fixupunattend.vbs new file mode 100644 index 000000000..12bafb8c4 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/windows/fixupunattend.vbs @@ -0,0 +1,40 @@ +Dim filesys, srcfile, srcfilename, fline, dstfilename, dstfile, myshell, netuse +Dim tmpstr, elems +Set myshell = WScript.createObject("WScript.Shell") +Set netuse = myshell.Exec("net use") +Dim drvletter +Do While Not netuse.StdOut.AtEndOfStream + tmpstr = netuse.StdOut.ReadLine() + if InStr(tmpstr,"install") > 0 Then + Do while InStr(tmpstr," ") > 0 + tmpstr = Replace(tmpstr," "," ") + Loop + elems = Split(tmpstr) + drvletter=elems(1) + End If +Loop + +Set filesys = CreateObject("Scripting.FileSystemObject") +dim notefi +notefi=1 +if filesys.FileExists(drvletter&"\utils\windows\detectefi.exe") then + notefi = myshell.run(drvletter&"\utils\windows\detectefi.exe",1,true) + WScript.Echo(notefi) +end if +WScript.Echo(notefi) +srcfilename = WScript.Arguments.Item(0) +dstfilename = WScript.Arguments.Item(1) +Set srcfile = filesys.OpenTextFile(srcfilename,1) +Set dstfile = filesys.OpenTextFile(dstfilename,2,True) +dim partitionscheme +Do Until srcfile.AtEndOfStream + fline = srcfile.ReadLine + if notefi=0 then + fline = Replace(fline,"==BOOTPARTITIONS==","1EFI2602MSR1283Primarytrue") + fline = Replace(fline,"==INSTALLTOPART==","3") + else + fline = Replace(fline,"==BOOTPARTITIONS==","1Primarytrue") + fline = Replace(fline,"==INSTALLTOPART==","1") + end if + dstfile.WriteLine(Replace(fline,"==INSTALLSHARE==",drvletter)) +Loop