Differences

This shows you the differences between two versions of the page.

Link to this comparison view

userspace:dynamics_navision_2009_rtc-client [2012/10/28 20:37] (current)
MatCris created
Line 1: Line 1:
 +====== Dynamics Navision 2009 Client RTC======
  
 +**Versions**\\
 +By  //​[[matteo.cristofaro(at)wupsi.de|Matteo Cristofaro]] 2012/10/27 21:33// \\
 +
 +
 +Tested with opsi 4.0.1.36\\
 +requiredWinstVersion >= 4.10.8.6
 +By  //​[[matteo.cristofaro(at)wupsi.de|Matteo Cristofaro]] 2012/10/27 21:33// \\
 +
 +
 +Das Setup-File wird im ScriptPath in einem Unterverzeichnis "​setup"​ abgelegt, also "​CLIENT_DATA\setup\RoleTailoredClient\..."​
 +
 +Das Verzeichnis RoleTailoredClient enthält die Install-Dateien des RTC-Clients und ist auf der DVD zu finden.
 +
 +Tree:\\
 +navision-2009-rtcclient.png\\
 +setup\RoleTailoredClient\...\\
 +setup.ins\\
 +uninstall.ins\\
 +delsub.ins\\
 +
 +
 +
 +==== setup.ins ====
 +<code winst>
 +[Actions]
 +DefVar $LogDir$
 +Set $LogDir$ = "​%SystemDrive%\tmp"​
 +DefVar $ProductId$
 +DefVar $MinimumSpace$
 +DefVar $InstallDir$
 +DefVar $ExitCode$
 +DefVar $LicenseRequired$
 +DefVar $LicenseKey$
 +DefVar $LicensePool$
 +
 +; ----------------------------------------------------------------
 +; - Please edit the following values ​                            -
 +; ----------------------------------------------------------------
 +Set $ProductId$ ​       = "​navision-2009-rtcclient"​
 +Set $MinimumSpace$ ​   = "200 MB"
 +Set $InstallDir$ ​     = "​%ProgramFilesDir%\Microsoft Dynamics NAV"
 +Set $LicenseRequired$ = "​false"​
 +Set $LicensePool$ ​     = "​p_"​ + $ProductId$
 +; ----------------------------------------------------------------
 +
 +if not(HasMinimumSpace ("​%SystemDrive%",​ $MinimumSpace$))
 + LogError "Not enough space on %SystemDrive%,​ " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
 + isFatalError
 + ; Stop process and set installation status to failed
 +else
 + comment "Show product picture"​
 + ShowBitmap "​%ScriptPath%\"​ + $ProductId$ + "​.png"​ $ProductId$
 +
 + if FileExists("​%ScriptPath%\delsub.ins"​)
 + comment "Start uninstall sub section"​
 + Sub "​%ScriptPath%\delsub.ins"​
 + endif
 +
 + Message "​Installing " + $ProductId$ + " ..."
 +
 + if not ($LicenseRequired$ = "​false"​)
 + comment "​Licensing required, reserve license and get license key"
 + Sub_get_licensekey
 + endif
 +
 + comment "Start setup program"​
 + Winbatch_install
 + Sub_check_exitcode
 +endif
 +
 +
 +
 +[Winbatch_install]
 +msiexec /i "​%ScriptPath%\setup\RoleTailoredClient\Microsoft Dynamics NAV RoleTailored Client.msi"​ /l* "​$LogDir$\$ProductId$.install_log.txt"​ /qb! ALLUSERS=2 REBOOT=ReallySuppress
 +
 +
 +
 +[Sub_get_licensekey]
 +if opsiLicenseManagementEnabled
 + comment "​License management is enabled and will be used"
 +
 + comment "​Trying to get a license key"
 + Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
 + ; If there is an assignment of exactly one licensepool to the product the following call is possible:
 + ; Set $LicenseKey$ = demandLicenseKey ("",​ $ProductId$)
 + ;
 + ; If there is an assignment of a license pool to a windows software id, it is possible to use:
 + ; DefVar $WindowsSoftwareId$
 + ; $WindowsSoftwareId$ = "​..."​
 + ; Set $LicenseKey$ = demandLicenseKey ("",​ "",​ $WindowsSoftwareId$)
 +
 + DefVar $ServiceErrorClass$
 + set $ServiceErrorClass$ = getLastServiceErrorClass
 + comment "Error class: " + $ServiceErrorClass$
 +
 + if $ServiceErrorClass$ = "​None"​
 + comment "​Everything fine, we got the license key '"​ + $LicenseKey$ + "'"​
 + else
 + if $ServiceErrorClass$ = "​LicenseConfigurationError"​
 + LogError "​Fatal:​ license configuration must be corrected"​
 + LogError getLastServiceErrorMessage
 + ExitWindows /Reboot
 + isFatalError
 + else ​
 + if $ServiceErrorClass$ = "​LicenseMissingError"​
 + LogError "​Fatal:​ required license is not supplied"​
 + ExitWindows /Reboot
 + isFatalError
 + endif
 + endif
 + endif
 +else
 + LogError "​Fatal:​ license required, but license management not enabled"​
 + isFatalError
 +endif
 +
 +
 +[Sub_check_exitcode]
 +comment "Test for installation success via exit code"
 +set $ExitCode$ = getLastExitCode
 +; informations to exit codes see
 +; http://​msdn.microsoft.com/​en-us/​library/​aa372835(VS.85).aspx
 +; http://​msdn.microsoft.com/​en-us/​library/​aa368542.aspx
 +if ($ExitCode$ = "​0"​)
 + comment "Looks good: setup program gives exitcode zero"
 +else
 + comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
 + if ($ExitCode$ = "​1605"​)
 + comment "​ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."​
 + comment "​Uninstall of a not installed product failed - no problem"​
 + else
 + if ($ExitCode$ = "​1641"​)
 + comment "looks good: setup program gives exitcode 1641"
 + comment "​ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."​
 + else
 + if ($ExitCode$ = "​3010"​)
 + comment "looks good: setup program gives exitcode 3010"
 + comment "​ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."​
 + else
 + logError "​Fatal:​ Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
 + isFatalError
 + endif
 + endif
 + endif
 +endif
 +</​code>​
 +
 +
 +
 +==== delsub.ins ====
 +<code winst>
 +DefVar $MsiId$
 +Set $MsiId$ = '​{00000000-0000-6002-0020-0000836BD2D2}'​
 +
 +Message "​Uninstalling " + $ProductId$ + " ..."
 +
 +if not (GetRegistryStringValue("​[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"​ + $MsiId$ + "] DisplayName"​) = ""​)
 + comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"​
 + Winbatch_uninstall_msi
 + sub_check_exitcode
 +endif
 +
 +comment "​Delete files"
 +Files_uninstall
 +
 +
 +
 +[Winbatch_uninstall_msi]
 +msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
 +
 +
 +
 +[Files_uninstall]
 +delete -sf "​$InstallDir$\"​
 +
 +
 +
 +[Sub_check_exitcode]
 +comment "Test for installation success via exit code"
 +set $ExitCode$ = getLastExitCode
 +; informations to exit codes see
 +; http://​msdn.microsoft.com/​en-us/​library/​aa372835(VS.85).aspx
 +; http://​msdn.microsoft.com/​en-us/​library/​aa368542.aspx
 +if ($ExitCode$ = "​0"​)
 + comment "Looks good: setup program gives exitcode zero"
 +else
 + comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
 + if ($ExitCode$ = "​1605"​)
 + comment "​ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."​
 + comment "​Uninstall of a not installed product failed - no problem"​
 + else
 + if ($ExitCode$ = "​1641"​)
 + comment "looks good: setup program gives exitcode 1641"
 + comment "​ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."​
 + else
 + if ($ExitCode$ = "​3010"​)
 + comment "looks good: setup program gives exitcode 3010"
 + comment "​ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."​
 + else
 + logError "​Fatal:​ Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
 + isFatalError
 + endif
 + endif
 + endif
 +endif
 +</​code>​
 +
 +
 +
 +==== uninstall.ins ====
 +<code winst>
 +[Initial]
 +requiredWinstVersion >= "​4.8.6"​
 +LogLevel=2 ;​ Log Errors in Logfile but don't abort:
 +ExitOnError=false ;​ Show syntax errors in the script:
 +ScriptErrorMessages=on ;​ Dont trace step by step through the script:
 +TraceMode=off ;​ Let started programs run in front of the winst window
 +StayOnTop=false
 +
 +[Aktionen]
 +DefVar $TEMP$
 +Set $TEMP$ = EnvVar("​TEMP"​)
 +DefVar $LogDir$
 +Set $LogDir$ = "​%SystemDrive%\tmp"​
 +DefVar $ExitCode$
 +DefVar $ProductId$
 +DefVar $InstallDir$
 +DefVar $LicenseRequired$
 +DefVar $LicensePool$
 +
 +; ----------------------------------------------------------------
 +; - Please edit the following values ​                            -
 +; ----------------------------------------------------------------
 +Set $ProductId$ ​      = "​navision-2009-rtcclient"​
 +Set $InstallDir$ ​     = "​%ProgramFilesDir%\Microsoft Dynamics NAV"
 +Set $LicenseRequired$ = "​false"​
 +Set $LicensePool$ ​    = "​p_"​ + $ProductId$
 +; ----------------------------------------------------------------
 +
 +comment "Show product picture"​
 +ShowBitmap /3 "​%ScriptPath%\"​ + $ProductId$ + "​.png"​ $ProductId$
 +
 +Message "​Uninstalling " + $ProductId$ + " ..."
 +
 +if FileExists("​%ScriptPath%\delsub.ins"​)
 + comment "Start uninstall sub section"​
 + Sub "​%ScriptPath%\delsub.ins"​
 +endif
 +
 +if not ($LicenseRequired$ = "​false"​)
 + comment "​Licensing required, free license used"
 + Sub_free_license
 +endif
 +
 +[Sub_free_license]
 +if opsiLicenseManagementEnabled
 + comment "​License management is enabled and will be used"
 +
 + comment "​Trying to free license used for the product"​
 + DefVar $result$
 + Set $result$ = FreeLicense($LicensePool$)
 + ; If there is an assignment of a license pool to the product, it is possible to use
 + ; Set $result$ = FreeLicense("",​ $ProductId$)
 + ;
 + ; If there is an assignment of a license pool to a windows software id, it is possible to use
 + ; DefVar $WindowsSoftwareId$
 + ; $WindowsSoftwareId$ = "​..."​
 + ; set $result$ = FreeLicense("",​ "",​ $WindowsSoftwareId$)
 +else
 + LogError "​Error:​ licensing required, but license management not enabled"​
 + isFatalError
 +endif
 +</​code>​

QR Code
QR Code userspace:dynamics_navision_2009_rtc-client (generated for current page)