too_much = 0\r
Do While objFSO.FileExists(filename)\r
On Error Resume Next \r
- objFSO.DeleteFile(filename)\r
+ objFSO.DeleteFile(filename),True \r
WScript.Sleep 100 ' milliseconds\r
too_much = too_much + 1 'We do not wait to much to delete the file, then we don't delete it.\r
if too_much > 50 then\r
Loop \r
End Function\r
\r
+\r
Function FileDelete(filename)\r
Dim fso\r
Set fso = CreateObject("Scripting.FileSystemObject")\r
Err.clear\r
If fso.FileExists(filename) Then\r
- fso.DeleteFile(filename), True\r
- If Err Then\r
- msgbox "Could not delete: " & filename\r
- ' Display error number and description if applicable\r
- ShowError\r
- Err.clear\r
- End If \r
+ On Error Resume Next \r
+ fso.DeleteFile(filename),True \r
+ If (Err AND Err.Number <> 70) Then\r
+ ErrMsg ("Could not delete: " & filename)\r
+ End If\r
End If\r
End Function\r
\r
+\r
Function FileMove(filename,destination)\r
Dim fso\r
Set fso = CreateObject("Scripting.FileSystemObject")\r
+ Err.clear \r
If fso.FileExists(filename) Then\r
On Error Resume Next \r
fso.MoveFile filename,destination\r
- 'if err then msgbox "Could not move: " & filename\r
- err.clear \r
+ If (Err AND Err.Number <> 70) then\r
+ ErrMsg ("Could not Move: " & filename & " to " & destination)\r
+ End If\r
End If\r
- ' Display error number and description if applicable\r
- If Err Then ShowError\r
End Function\r
\r
\r
FileDelete(sDRIVERS & "ibsrp.sys")\r
FileDelete(sDRIVERS & "vnic.sys")\r
\r
- If (MTARCH="amd64" Or MTARCH="ia64") Then\r
+ If (MTARCH="amd64") Then\r
' System64Folder = System32, SystemFolder = Syswow64\r
' check/remove from .dll cache prior to removal from system32\\r
Dim dllCache\r
\r
' MTARCH=x86 SystemFolder = System32\r
' MTARCH=amd64 SystemFolder = Syswow64\r
- FileDelete(sSystemFolder & "ibal.dll")\r
+ FileDelete(sSystemFolder & "ibal.dll")\r
FileDelete(sSystemFolder & "ibald.dll")\r
- FileDelete(sSystemFolder & "complib.dll")\r
+ FileDelete(sSystemFolder & "complib.dll")\r
FileDelete(sSystemFolder & "complibd.dll")\r
- FileDelete(sSystemFolder & "mthcau.dll")\r
+ FileDelete(sSystemFolder & "mthcau.dll")\r
FileDelete(sSystemFolder & "mthcaud.dll")\r
- FileDelete(sSystemFolder & "ibsrp.dll")\r
+ FileDelete(sSystemFolder & "ibsrp.dll")\r
FileDelete(sSystemFolder & "ibsrpd.dll")\r
- FileDelete(sSystemFolder & "IbInstaller.dll")\r
- FileDelete(sSystemFolder & "ibwsd.dll")\r
+ FileDelete(sSystemFolder & "IbInstaller.dll")\r
+ FileDelete(sSystemFolder & "ibwsd.dll")\r
\r
FileDelete(Win & "lastgood\system32\ibwsd.dll")\r
FileDelete(Win & "lastgood\sys64wow\ibwsd.dll")\r
"{impersonationLevel=impersonate}!\\" & _\r
strComputer & "\root\default:StdRegProv")\r
\r
+ On Error Resume Next \r
' Display error number and description if applicable\r
' If Err Then ShowError\r
Return = objReg.DeleteKey(HKEY_LOCAL_MACHINE, KeyPath)\r
strComputer & "\root\default:StdRegProv")\r
\r
\r
+ On Error Resume Next \r
Return = objReg.DeleteValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName)\r
' Display error number and description if applicable\r
If Err Then ShowError\r
Const HKEY_LOCAL_MACHINE = &H80000002\r
dim strComputer\r
strComputer = "."\r
+ On Error Resume Next \r
Set objReg=GetObject("winmgmts:" & _\r
"{impersonationLevel=impersonate}!\\" & _\r
strComputer & "\root\default:StdRegProv")\r
''''''''''' Driver Install ''''''''''''\r
\r
Sub DriverInstall()\r
+\r
MTARCH = Architecture\r
\r
' Get the value of INSTALLDIR\r
Dim sInstalldir\r
sInstalldir = PropArray(0)\r
\r
+ Uninstall_IB_Devices(sInstalldir)\r
+\r
RemoveDriverFiles\r
\r
Set WshShell = CreateObject("WScript.Shell")\r
\r
' rescan system buses\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe rescan", 0, true)\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe rescan", 0, true)\r
' Display error number and description if applicable\r
If Err Then ShowError\r
\r
' Install HCA Driver\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe update mthca.inf PCI\VEN_15b3", 0, true)\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe update mthca.inf PCI\VEN_15B3",_\r
+ 0, true)\r
' Display error number and description if applicable\r
If Err Then ShowError\r
\r
' Check/install IPoIB driver\r
' Only if InstallShield component 'net' is NOT tagged as containing a Device Driver \r
If fso.FileExists(sInstalldir & "net\netipoib.inf") Then\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "net & ..\IBcore\devman.exe update netipoib.inf IBA\IPoIB", 0, true)\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "net & ..\IBcore\devman.exe update netipoib.inf IBA\IPoIB",_\r
+ 0, true)\r
If Err Then ShowError\r
End If\r
\r
sInstalldir = Session.Property("INSTALLDIR")\r
Set WshShell = CreateObject("WScript.Shell")\r
\r
- Set ibaDevicesExec = WshShell.Exec ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe FindAll * | FIND ""IBA""")\r
+ Set ibaDevicesExec = WshShell.Exec ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe findall * | find ""IBA"" ")\r
ibaDevices = split(ibaDevicesExec.StdOut.ReadAll, vbCrLF)\r
\r
' Getting the array Size\r
dim arrSize\r
+ dim ibaDev()\r
+\r
arrSize = 0\r
for each deviceCan in ibaDevices\r
if (Instr(deviceCan,"IBA\") = 1) Then\r
arrSize = arrSize + 1\r
End if\r
- next\r
+ next \r
+ \r
+ ' Any work to do?\r
+ If arrSize = 0 Then\r
+ FindDevices=ibaDev\r
+ Exit Function\r
+ End if\r
+ 'msgbox "FindDevices(IBA\IPOIB) size " & arrSize ' XXX\r
+\r
'Creating array of IBA\ devices\r
- dim ibaDev()\r
Redim ibaDev(arrSize - 1)\r
index = 0\r
for each deviceCan in ibaDevices\r
End Function\r
\r
\r
+Function Uninstall_IB_Devices(sInstalldir)\r
\r
-''''''''''' Driver Uninstall ''''''''''''\r
-\r
-Sub DriverUninstall() \r
- Dim sInstalldir, WshShell, fso, devices\r
-\r
- sInstalldir = Session.Property("INSTALLDIR")\r
+ Dim WshShell, fso, devices\r
\r
Set WshShell = CreateObject("WScript.Shell")\r
Set fso = CreateObject("Scripting.FileSystemObject")\r
\r
- MTARCH = Architecture\r
- \r
- ' WSD doesn't work on XP and should NOT be installed; just in case.\r
- ' if WSD installed, then it's enabled, shut down the service\r
-\r
- If (Session.Property("VersionNT") <> 501) AND fso.FileExists(sInstalldir & "installsp.exe") Then\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & " & installsp.exe -r", 0, true)\r
- End If\r
- \r
- ' stop the openSM service in case it was started.\r
- Return = WshShell.Run ("cmd.exe /c sc.exe stop opensm", 0, true)\r
-\r
- ' delete opensm service from regisry\r
- Return = WshShell.Run ("cmd.exe /c sc.exe delete opensm", 0, true)\r
- If Err Then ShowError\r
+ If (fso.FileExists(sInstalldir & "IBcore\devman.exe") = False) Then\r
+ Exit Function ' no reason to continue without the tool.\r
+ End if\r
\r
' create a list of IBA\ devices via 'devcon findall'\r
+\r
devices = FindDevices\r
\r
' Remove IPoIB Adapter instances\r
if (Instr(deviceCan,"IBA\IPOIB")) Then\r
device = split(deviceCan, " ")\r
' Removing\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe remove @" & device(0), 0, true)\r
+ 'msgbox "RmDev " & device(0) ' XXX\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe remove @" & device(0), 0, true)\r
End if\r
Next\r
\r
if (Instr(deviceCan,"InfiniBand I/O Unit")) Then\r
device = split(deviceCan, " ")\r
' Removing I/O Unit of the SRP\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe remove @" & device(0), 0, true)\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe remove @" & device(0), 0, true)\r
End if\r
Next\r
\r
if (Instr(deviceCan,"SRP")) Then\r
device = split(deviceCan, " ")\r
' Removing SRP\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe remove @" & device(0), 0, true)\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe remove @" & device(0), 0, true)\r
End if\r
Next\r
\r
- Set objWshScriptExec = wshShell.Exec("cmd.exe /c " & sInstalldir & "IBcore & devman.exe FindAll * | FIND ""IPOIB""")\r
+ Set objWshScriptExec = wshShell.Exec("cmd.exe /c " & sInstalldir _\r
+ & "IBcore & devman.exe FindAll * | FIND ""IPOIB""")\r
If Err Then ShowError\r
Set objStdOut = objWshScriptExec.StdOut\r
\r
While Not objStdOut.AtEndOfStream\r
strLine = objStdOut.ReadLine\r
device = split(strLine, " ")\r
- Return = wshShell.run("cmd.exe /c cd " & sInstallDir & "IBcore & devman.exe remove @" & device(0),0,true)\r
+ Return = wshShell.run("cmd.exe /c cd " & sInstallDir _\r
+ & "IBcore & devman.exe remove @" & device(0),0,true)\r
Wend\r
\r
+ ' Remove HCAs\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe remove PCI\VEN_15B3", 0, true)\r
+ If Err Then ShowError\r
+\r
' Remove InfiniBand Bus/Fabric class driver\r
\r
- Set objWshScriptExec = wshShell.Exec("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe FindAll * | FIND ""InfiniBand Fabric""")\r
+ Set objWshScriptExec = wshShell.Exec("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe FindAll * | FIND ""InfiniBand Fabric"" ")\r
If Err Then ShowError\r
+\r
Set objStdOut = objWshScriptExec.StdOut\r
\r
While Not objStdOut.AtEndOfStream\r
strLine = objStdOut.ReadLine\r
device = split(strLine, " ")\r
- Return = wshShell.Run("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe remove @" & device(0),0,true)\r
+ Return = wshShell.Run("cmd.exe /c cd " & sInstalldir _\r
+ & "IBcore & devman.exe remove @" & device(0),0,true)\r
If Err Then ShowError\r
Wend\r
\r
- ' Remove HCAs\r
- Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe remove PCI\VEN_15b3", 0, true)\r
+End Function\r
+\r
+\r
+''''''''''' Driver Uninstall ''''''''''''\r
+\r
+Sub DriverUninstall() \r
+\r
+ Dim sInstalldir, WshShell, fso\r
+\r
+ sInstalldir = Session.Property("INSTALLDIR")\r
+\r
+ Set WshShell = CreateObject("WScript.Shell")\r
+ Set fso = CreateObject("Scripting.FileSystemObject")\r
+\r
+ ' WSD (Winsock Direct) doesn't work on XP and should NOT be installed.\r
+ ' If WSD is installed, then it's enabled (!XP), shut down the service\r
+\r
+ If (Session.Property("VersionNT") <> 501) AND fso.FileExists(sInstalldir & "installsp.exe") Then\r
+ Return = WshShell.Run ("cmd.exe /c cd " & sInstalldir & " & installsp.exe -r", 0, true)\r
+ End If\r
+ \r
+ ' stop the openSM service in case it was started.\r
+ Return = WshShell.Run ("cmd.exe /c sc.exe stop opensm", 0, true)\r
+\r
+ ' delete opensm service from registry\r
+ Return = WshShell.Run ("cmd.exe /c sc.exe delete opensm", 0, true)\r
If Err Then ShowError\r
\r
+ Uninstall_IB_Devices(sInstalldir)\r
+\r
' Remove Service entries from the registry\r
\r
DeleteRegKey "System\CurrentControlSet\Services\ibbus"\r
End if\r
Next\r
\r
- ' remove driver installed files\r
- RemoveDriverFiles\r
+ RemoveDriverFiles ' remove driver installed files\r
\r
Session.Property("REBOOT") = "FORCE" \r
err.clear \r
End Sub\r
\r
+\r
' Enable WSD if installsp.exe was installed (feature Winsock direct selected).\r
' For Windows XP, this CA should not be called as WSD is not supported on XP.\r
\r
\r
\r
Sub ShowError()\r
- strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _\r
+ msgbox vbCrLf & "Error # " & Err.Number & vbCrLf & _\r
Err.Description & vbCrLf & vbCrLf\r
- 'Syntax\r
- Session.Message strMsg\r
+ Err.clear\r
+End Sub\r
+\r
+Sub ErrMsg(msg)\r
+ msgbox msg &vbCRLF & "Error # " & Err.Number & vbCRLF & Err.Description\r
+ Err.clear\r
End Sub\r
\r
\r
End Sub\r
\r
\r
-' Determine if an existing WinOF or openib-window installation exists.\r
-' If existing, determined by registry entry for service/ibbus,\r
+Sub ScheduleReboot\r
+ \r
+ Set objWMILocator = CreateObject ("WbemScripting.SWbemLocator") \r
+ objWMILocator.Security_.Privileges.AddAsString "SeShutdownPrivilege",True \r
+ Set objWMIServices = objWMILocator.ConnectServer(strComputerName, _\r
+ cWMINameSpace, strUserID, strPassword)\r
+ Set objSystemSet = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem")\r
+ ' Forced restart\r
+ For Each objSystem In objSystemSet\r
+ objSystem.Win32Shutdown 2+4\r
+ objSystem.Win32Shutdown 2+4\r
+ objSystem.Win32Shutdown 2+4\r
+ Next\r
+ \r
+ 'msgbox "Please wait while computer restart ...",0,"MellanoxWinIB32"\r
+\r
+End Sub\r
+\r
+\r
+' Determine if an existing WinOF or openib-window installation is present.\r
+' If previous install exists, determined by registry entry for service/ibbus,\r
' then uninstall and reboot.\r
' Called in immediate mode, condition: INSTALL=1\r
\r
Const wshQuestionMark = 32\r
\r
Dim status ' check if ibbus.sys exists, if not the reboot won't happen\r
- Dim fso\r
+ Dim fso, originalReboot\r
Set fso = CreateObject("Scripting.FileSystemObject") \r
status = 0\r
\r
Return = WshShell.Run ("reg.exe query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ibbus /v ImagePath", 0, true)\r
If (Return = 0) And (Err.Number = 0) Then\r
Status = Status + 1\r
- End if\r
+ End if\r
+ \r
+ originalReboot = Session.Property("REBOOT") \r
+ \r
+ DriverUninstall\r
\r
' if we can't find registry entry, then no need to uninstall/restart.\r
' Proceed with installation\r
If status = 0 then\r
- ' msgbox "No existing InfiniBand installation detected"\r
+ ' msgbox "No existing InfiniBand installation detected"\r
+ Session.Property("REBOOT") = originalReboot\r
Exit Function\r
End if\r
\r
+ Dim sys_folder, drv_folder\r
+ ' Idea here is to rename driver files to force a driver\r
+ ' load failure upon next reboot so ensuing install will\r
+ ' succeed.\r
+ sys_folder = Session.Property("WindowsFolder") & "system32"\r
+ drv_folder = sys_folder & "\drivers"\r
+ \r
+ If fso.FileExists(drv_folder & "\ibbus.sys") Then\r
+ FileMove drv_folder & "\ibbus.sys",drv_folder & "\ibbus.sy1"\r
+ End if\r
+ If fso.FileExists(drv_folder & "\mthca.sys") Then\r
+ FileMove drv_folder & "\mthca.sys",drv_folder & "\mthca.sy1"\r
+ End if \r
+ If fso.FileExists(sys_folder & "\ibinstaller.dll") Then\r
+ FileMove sys_folder & "\ibinstaller.dll",sys_folder & "\ibinstaller1.dll"\r
+ End if\r
+ \r
' Notify the user an existing non WinOF IB installation was detected and\r
' the system will be rebooted.\r
dim res\r
\r
- res = WshShell.Popup("Existing InfiniBand installation has been removed.",12,"WinOF - Existing InfiniBand installation Detected") \r
+ res = WshShell.Popup("Existing InfiniBand installation has been removed." _\r
+ & vbCRLF & vbCRLF & "Automatic REBOOT in 10 seconds."_\r
+ & vbCRLF & "Please re-install WinOF."_\r
+ ,15,"WinOF - Existing InfiniBand installation Detected")\r
+ \r
+ 'run_once_cmd = Session.Property("SETUPEXEDIR") & "\setup.exe"\r
+ 'RunAtReboot(run_once_cmd)\r
+ \r
+ ' the _Driver Uninstall call sets reboot=force. The ForceReboot action\r
+ ' following this CustomAction will fire when reboot is set =force.\r
+ ' The problem is we need to fail the installation so it cleans up, not\r
+ ' a partial install, and still reboots - So far IS-12 doesn;t support\r
+ ' this behavior.\r
+\r
+ ScheduleReboot\r
\r
- ' proceed with Uninstall and reboot.\r
+ ' Fail the install so cleanup occurs.\r
' Upon system restart, WinOF installation needs to be restarted \r
' consider a run-once invocation.\r
\r
- DriverUninstall\r
-\r
- ChkInstallAndReboot = 0\r
-\r
- ' the _Driver Uninstall call sets reboot=force. The ForceReboot action\r
- ' following this CustomAction will fire when reboot is set =force.\r
+ ChkInstallAndReboot = 2 ' will force install cleanup.\r
\r
End Function\r
\r
+\r
' This routine should never be...InstallShield-12 for some reason has\r
' decided not to completely remove [INSTALLDIR]? Until such a time\r
' that 'why' is understood, this routine removes [INSTALLDIR]! Sigh...\r