]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[WinOF] DAPLsetup CA, create %SystemDrive%\DAT if needed.
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 28 Jun 2007 22:58:49 +0000 (22:58 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 28 Jun 2007 22:58:49 +0000 (22:58 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@730 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/WinOF/WIX/CustomActions.vbs

index cc296562e28b2f40450e750ea97e3a1d528212d2..f7fa5d75d7ec1f063a883e44532391a9bb0f6183 100644 (file)
@@ -1,4 +1,4 @@
-' WIX CustomActions used in the WinOF (Windows OpenFabrics) Release\r
+' WIX CustomActions used in the WinOF (Windows OpenFabrics) Release.\r
 ' File is based on the file contributed by Mellanox Technologies.\r
 \r
 Function Architecture()\r
@@ -909,62 +909,94 @@ End Function
 ' Create OpenSM (Subnet Management) windows service disabled.\r
 \r
 Sub OpensmServiceEvent()\r
-       Dim sInstalldir,opensmPath,opensmService,WshShell,fso\r
-       Dim sc, StartMeUp\r
+    Dim sInstalldir,opensmPath,opensmService,WshShell,fso\r
+    Dim sc, StartMeUp\r
 \r
-       sInstalldir = Session.Property("INSTALLDIR")\r
-       opensmService = sInstalldir & "opensm.service.txt"\r
-       opensmPath = sInstalldir & "opensm.exe"\r
+    sInstalldir = Session.Property("INSTALLDIR")\r
+    opensmService = sInstalldir & "opensm.service.txt"\r
+    opensmPath = sInstalldir & "opensm.exe"\r
 \r
     Set fso = CreateObject("Scripting.FileSystemObject")\r
     Set WshShell = CreateObject("WScript.Shell")\r
     \r
-       ' opensm.exe is required\r
-       If Not fso.FileExists(opensmPath) Then\r
-               Exit Sub\r
+    ' opensm.exe is required\r
+    If Not fso.FileExists(opensmPath) Then\r
+       Exit Sub\r
     End if\r
 \r
-       sc = "sc.exe create opensm binPath= """ &opensmPath _\r
-                       & " -e --service"" DisplayName= ""InfiniBand Subnet Manager"" "\r
+    sc = "sc.exe create opensm binPath= """ &opensmPath _\r
+               & " -e --service"" DisplayName= ""InfiniBand Subnet Manager"" "\r
 \r
-       ' start opesm as a Service?\r
-       If fso.FileExists(opensmService) Then\r
-           StartMeUp = True\r
-           sc = sc & "start= auto"\r
-       Else\r
-           StartMeUp = False\r
-           sc = sc & "start= disabled"\r
+    ' start opesm as a Service?\r
+    If fso.FileExists(opensmService) Then\r
+       StartMeUp = True\r
+       sc = sc & "start= auto"\r
+    Else\r
+       StartMeUp = False\r
+       sc = sc & "start= disabled"\r
     End if\r
     Return = WshShell.Run ("cmd.exe /c " & sc, 0, true)\r
     sc = "sc.exe description opensm ""Configures and manage the InfiniBand Subnet"" "\r
     Return = WshShell.Run ("cmd.exe /c " & sc, 0, true)\r
 \r
     ' Is opensm to be run as a service?\r
-       If StartMeUp Then\r
+    If StartMeUp Then\r
        Return = WshShell.Run ("cmd.exe /c sc.exe start opensm", 0, true)\r
-       End if\r
-       err.clear\r
+    End if\r
+    err.clear\r
 End Sub\r
 \r
+' If not present, then create %SystemDrive%\DAT\dat.conf\r
+\r
+Function DAPL_setup()\r
+      Dim sSysDrive, DatFolder, SrcFile, WshShell, fso\r
+\r
+      Set WshShell = CreateObject("WScript.Shell")\r
+      Set fso = CreateObject("Scripting.FileSystemObject")\r
+\r
+      DAPL_setup = 0\r
+      Err.clear\r
+\r
+      SrcFile = Session.Property("INSTALLDIR") & "dat.conf"\r
+\r
+      If fso.FileExists(SrcFile) Then\r
+         On Error Resume Next \r
+          sSysDrive = Session.Property("WindowsVolume")\r
+          ' sSysDrive = WshShell.ExpandEnvironmentStrings("%SystemDrive%") \r
+          DatFolder = sSysDrive & "DAT"\r
+          If fso.FolderExists(DatFolder) Then\r
+              ' Preserve existing %SystemDrive%\DAT\r
+              Exit Function\r
+          End if\r
+          ' create %SystemDrive%\DAT & install dat.conf\r
+          fso.CreateFolder DatFolder\r
+          If Err Then\r
+              ErrMsg "Unable to create folder %SystemDrive%\DAT"\r
+              Exit Function\r
+          End if\r
+          fso.CopyFile SrcFile, DatFolder & "\dat.conf"\r
+      End if\r
+End Function\r
+\r
 \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(_\r
-                       "winmgmts:{impersonationLevel=impersonate,(Shutdown)}")._\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(_\r
+       "winmgmts:{impersonationLevel=impersonate,(Shutdown)}")._\r
                                InstancesOf("Win32_OperatingSystem")\r
 \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
+    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
+    'msgbox "Please wait while computer restarts ...",0,"WinOF"\r
 \r
 End Sub\r
 \r
@@ -980,8 +1012,8 @@ Function ChkInstallAndReboot()
     Const wshYesNoDialog = 4\r
     Const wshQuestionMark = 32\r
 \r
-       Dim status ' check if ibbus.sys exists, if not the reboot won't happen\r
-       Dim fso, originalReboot\r
+    Dim status ' check if ibbus.sys exists, if not the reboot won't happen\r
+    Dim fso, originalReboot\r
     Set fso = CreateObject("Scripting.FileSystemObject")    \r
     status = 0\r
     \r
@@ -1003,23 +1035,23 @@ Function ChkInstallAndReboot()
        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
+    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
@@ -1027,13 +1059,13 @@ Function ChkInstallAndReboot()
     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
+             ,13,"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 _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
@@ -1041,8 +1073,8 @@ Function ChkInstallAndReboot()
     ScheduleReboot\r
 \r
     ' Fail the install so cleanup occurs.\r
-       ' Upon system restart, WinOF installation needs to be restarted \r
-       ' consider a run-once invocation.\r
+    ' Upon system restart, WinOF installation needs to be restarted \r
+    ' consider a run-once invocation.\r
 \r
        ChkInstallAndReboot = 2 ' will force install cleanup.\r
 \r