Monday, April 27, 2009


AppDeploySM Package Knowledge Base

Class Act Variants 0.x

Company: University of Aberdeen
Setup type: Native Windows Installer setup (MSI)
Package Difficulty Rating: not yet established
Most Commonly Reported Method Used: not yet established


Notes

These are a series of Educational programs written by University of Aberdeen.

Although the applications are standard MSIs, when you first run them you are prompted for a serial code, and then prompted to accept the EULA.

Each of these steps creates a file in the same folder as the executable.

Here's the steps I used..

Install the MSI on a test PC, run it, enter the serial, and accept the EULA.

Browse to the folder of the exe - usually C:\Program Files\Educational Networking\[something]

Copy the files license.lic and tocagreed.yes to a server folder.

Now on your deployment script, it should be a simple case of run the MSI, and then copy these two files back.

In my case, the school purchased about 15 sub-packages, each with their own MSI.. I used a small autoit script which does them en-masse..

Each of these also needs .NET 3.5 (version 3521022), so I have the script check for it and install it if it isn't there.


Apologies in advance for the shocking code - you're more than welcome to tidy it up! :-)

Folder structure is:
[autoit script compiled exe]
Folder called LicFiles containing the 2 files listed above
Then as many sub-folders as needed containing the MSIs for each sub-program.
Folder called DotNet35
within that:
silent.bat
dotnetfx35.exe
hotfixes\NDP20SP2-KB958481-x86.exe
hotfixes\NDP30SP2-KB958483-x86.exe
hotfixes\NDP35SP1-KB958484-x86.exe
hotfixes\WindowsXP-KB961118-x86-ENU.exe

DotNet35\silent.bat is:
start /wait dotnetfx35.exe /q:a /c:"setup.exe /q /norestart" /norestart
start /wait hotfixes\NDP20SP2-KB958481-x86.exe /passive /norestart
start /wait hotfixes\NDP30SP2-KB958483-x86.exe /passive /norestart
start /wait hotfixes\NDP35SP1-KB958484-x86.exe /passive /norestart
start /wait hotfixes\WindowsXP-KB961118-x86-ENU.exe /quiet /norestart

Autoit script code:
; Install Class Act Variants

#Include <_filelisttoarraynew2g.au3>
#Include

; Search through for all MSIs in the folder, and install 'em

Dim $Syntax
Dim $Header
Dim $MSIFilesArray[100]
Dim $FilesArray[100]
Dim $BatFile

$BatFile = @TempDir & "\CA.bat"

$Syntax = "@Echo Off" & @CRLF
$Header = ""

Dotnetcheck()
ListMSIFiles()
InstallApps()
RegisterApps()

EXIT


; ===================================================================================
Func dotnetcheck()

$DotNetVerNum = 0
$DotNetVerMin = 3521022

; Check if .NET 3.5 is installed

$DotNetKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5"
$DotNetVer = RegRead($DotNetKey, "Version")

If @Error = 0 then
$DotNetVerString = StringReplace($DotNetVer, ".", "")
$DotNetVerString = StringMid($DotNetVerString, 1, StringLen($DotNetVerMin))
$DotNetVerNum = Number($DotNetVerString)

;msgbox(0, "", $DotNetVerString & @CRLF & $DotNetVerNum)
EndIf


If $DotNetVerNum > $DotNetVerMin then
Return
EndIf

; Generate .NET 3.5 installer

$DotNetDir = @ScriptDir & "\DotNet35"
$DotNetBATFilename = "silent.bat"

If FileExists($DotNetDir & "\" & $DotNetBATFilename) then
$Syntax = $Syntax & "PUSHD " & Chr(34) & $DotNetDir & Chr(34) & @CRLF
$Syntax = $Syntax & "CALL " & Chr(34) & $DotNetBATFilename & Chr(34) & @CRLF
$Syntax = $Syntax & "POPD " & @CRLF

EndIf

EndIf
EndFunc
; ===================================================================================


; ===================================================================================
Func ListMSIFiles()
$Filter = "*.msi"
$iFlag = "1" ;files only
$i_recurse = "1"

$MSIFilesArray=_FileListToArray3(@ScriptDir, $Filter, 1, 1)
If @Error = 0 then
If $MSIFilesArray[0] > 1 then
For $loop = 1 to $MSIFilesArray[0]
$Syntax = $Syntax & "MSIEXEC /i " & Chr(34) & $MSIFilesArray[$loop] & Chr(34) & " /qn /norestart" & @CRLF
Next
EndIf
EndIf
EndFunc
; ===================================================================================


; ===================================================================================
Func InstallApps()

$Log = FileOpen($BatFile, 2)
FileWriteLine($Log, $Syntax)
FileClose($Log)
RunWait($BatFile, @ScriptDir, @SW_HIDE)
EndFunc
; ===================================================================================


; ===================================================================================
Func RegisterApps()
; Copy the licence and EULA acceptance files to each folder

$Dir = @ProgramFilesDir & "\Educational Networking"
$Filter = "*.exe"
$iFlag = "1" ;files only
$i_recurse = "1"
$LicDir = @ScriptDir & "\Licfiles"

$FilesArray=_FileListToArray3($Dir, $Filter, 1, 1)
If @Error = 0 then
If $FilesArray[0] > 1 then

For $loop = 1 to $FilesArray[0]
$exe = $FilesArray[$loop]
$break = StringInStr($exe, "\", 0, -1)
If $break <> 0 then
$exedir = StringMid($exe, 1, $break -1)
;msgbox(0, "", $
FileCopy($LicDir & "\*.*", $exedir, 1)
;msgbox(0, "", $exedir)
EndIf
Next
EndIf
EndIf
EndFunc (Provided by sirclive)

Command Lines

No Entries.

Related Links

No Entries.

Lockdown Information

No Entries.


http://www.appdeploy.com/packages/detail.asp?id=1508


No comments:

Post a Comment