Changes

Jump to: navigation, search

Matlab

1,311 bytes added, 08:32, 15 April 2011
no edit summary
Silent installer for Matlab 2010b. Simply using the command line to run the Matlab provided setup.exe along with the argument -inputfile followed by a preconfigured input file containing your license key, silent install option etc, just won't work. It seems that when the setup.exe is run, it spawns a new setup.exe (with another pid), the original setup.exe then exits, wpkg then sees this exit, tries to check the program has installed ok and fails. Meanwhile, the spawned setup.exe continues and installs Matlab.
To get around this, an Autoit script was written that is passed two 4 arguments. The first one is the path to the setup.exe program, the . The second is the argument required to read in a log file. For Matlab this is '-inputfile'. The third is the path to the input file. After setup.exe The fourth is startedthe time in seconds after which you want monitoring to start, a small sleep allows give the spawned 'real' setup.exe time to start. All the processes called 'setup.exe' are then searched for along with the command they are running. If one of the setup.exe's commands contain the string 'matlab'of the third argument, the config file, then this its PID is obtained. In a While loop, the existance of this PID is checked, if it still exists, sleep, then re-check. If the PID doesn't exist, close the autoit exe, it is at this point that the install of Matlab would of finished and it is only now do we return pack the WPLG XML that will go and check the install has succeeded/failed.
Passing the arguments to the Autoit script allows multiple licensed toolboxes to be installed.
 
To remove Matlab and/or Matlab toolboxes, you can't simply run the documented command line:
 
<pre>
"%SYSTEMDRIVE%\matlab-%version%\uninstall\bin\win32\uninstall.exe" -inputfile "%SOFTWARE%\math_progs\\matlab_2010b_uninstaller_input.txt"
</pre>
 
If you do, the uninstall.exe program will start, launch the uninstall gui (hidden from view of course so you've no idea what's going on) and sit there. To 'make it work', create a very simple batch file that accepts two arguments, one, the path the the uninstall.exe and the second, the path to the input file (copy of this input file is in {path to matlab}\uninstall\). Run this batch file as the <remove>.
<source lang="xml">
<pre>
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=icon.ico
#AutoIt3Wrapper_Outfile=matlab_install_wpkg.exe
#AutoIt3Wrapper_Change2CUI=y
If @Compiled = 1 Then
If $CmdLine[0] < 2 4 Then MsgBox(32, "Usage", "KeepAlive WPKG Installer Usage:" & @CRLF & @CRLF & "For some installers (Java based), a program setup " & _ "program exits before the install has finished. This program stops the premature exiting until the installer " & _ "has finished. It does this by monitoring the PID of the installer and only exiting when the installer has finished. Useful " & _ "when installing a program with WPKG." & @CRLF & @CRLF & @ScriptName & " (path to Matlab setup.exe programs' install program) (argument " & _ "needed to include config file) (path to config file) (time in seconds to wait before monitoring installer)" & @CRLF & @CRLF _ @CRLF & "E.g. " & @ScriptName & " %LOGONSERVER%\wpkg7\server\WPKG-1.1.2\programs\math_progs\matlab-2010b\setup.exe " & _ "-inputFile %LOGONSERVER%\wpkg7\server\WPKG-1.1.2\programs\math_progs\matlab_2010b_input.txt 5" & @CRLF & @CRLF & _ "This script creates a log file in the users running this scripts Temp dir called {exe of 1st argument}_install.log" & @CRLF & @CRLF _ & "C. Mortimer 2011", 30)
Exit
Else
$install_prog = $CmdLine[1]
$config_file call_argument_wth = $CmdLine[2] $config_file = $CmdLine[3] $wait_time = $CmdLine[4] * 1000
EndIf
Else
;~ $install_prog = "\\winsam\netlogon\scripts\ssh_key.reg"Exit ;~ $install_prog = "\\winsam\netlogon\scripts\ssh_key_byhost"not really going to be run without compiling it
EndIf
$run_install q = Run1$process_name = StringTrimLeft($install_prog & , StringInStr($install_prog, " -inputFile \" & $config_file, 0, -1))
$log run_install = FileOpenRun(EnvGet("temp") & "\matlab_running", 2)FileWriteLine($log, "Now starting. Program to run = '" & $install_prog & "', config = '" & $config_file call_argument_wth & "'. [PID = " & $run_install & "] [" & @HOUR & ":" & @MIN & ":" & @SEC & "]"config_file); Run the installer...
Sleep$log = FileOpen(5000EnvGet("temp") & "\" & $process_name & "_install.log", 2) ; Open the log file deleting all existing dataFileWriteLine($log, "Now starting. Program to run = '" & $install_prog & "', argument required to call in config file ='" & $call_argument_wth & "'," & @CRLF & "config file = '" & $config_file & "', search string = '" & $install_prog & "', wait before monitoring = '" & $wait_time / 1000 & "s'. [PID = " & $run_install & "] [" & @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "]")FileClose($log)
Sleep($q = 1$process_name = "setup.exe"wait_time)
While $q = 1
$log = FileOpen(EnvGet("temp") & "\matlab_running" & $process_name & "_install.log", 1); append to the log file
$avRET = _ProcessListProperties($process_name)
$array_search = _ArraySearch($avRET, "matlab"$call_argument_wth, "", "", 0, 1);~ FileWriteLine($log, "$array_search = " & $array_search)
If $array_search >= 0 Then
FileWriteLine($log, $process_name & "Setup still running... [PID = " & $avRET[$array_search][1] & "] [" & @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "]")
FileClose($log)
Else
FileWriteLine($log, "Now exiting, " & $process_name & " no long running. [" & @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "]")
FileClose($log)
$q = 2
</pre>
==Remove bat file=Removal of Matlab=== To remove Matlab and/or Matlab toolboxes, you can't simply run the documented command line: <pre>"%SYSTEMDRIVE%\matlab-%version%\uninstall\bin\win32\uninstall.exe" -inputfile "%SOFTWARE%\math_progs\\matlab_2010b_uninstaller_input.txt"</pre> If you do, the uninstall.exe program will start, launch the uninstall gui (hidden from view of course so you've no idea what's going on) and sit there. To 'make it work', create a very simple batch file that accepts two arguments, one, the path the the uninstall.exe and the second, the path to the input file (copy of this input file is in {path to matlab}\uninstall\). Run this batch file as the <remove>.
<pre>
Anonymous user

Navigation menu