====== Octopus Desk UC ====== **Versions**\\ By //[[matteo.cristofaro(at)wupsi.de|Matteo Cristofaro]] 2012/08/17 22:15// \\ Tested with opsi xxxxx\\ requiredWinstVersion >= 4.10.8.6 By //[[matteo.cristofaro(at)wupsi.de|Matteo Cristofaro]] 2012/08/17 22:15// \\ Der Ordnerinhalt des DeskUC-Setups wird im ScriptPath in einem Unterverzeichnis "setup" abgelegt, also "CLIENT_DATA\setup\*.*" Tree:\\ delsub3264.ins\\ octopus-desk-uc.PNG\\ setup\*.* (Ordnerinhalt von der CD)\\ setup3264.ins\\ uninstall3264.ins ==== setup3264.ins ==== [Actions] requiredWinstVersion >= "4.10.8.6" DefVar $MsiId32$ DefVar $UninstallProgram32$ DefVar $MsiId64$ DefVar $UninstallProgram64$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir32$ DefVar $InstallDir64$ DefVar $InstProg$ DefVar $ExitCode$ DefVar $LicenseRequired$ DefVar $LicenseKey$ DefVar $LicensePool$ DefVar $INST_SystemType$ DefVar $INST_architecture$ Set $INST_SystemType$ = GetSystemType Set $INST_architecture$ = GetProductProperty("install_architecture","system specific") Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "octopus-desk-uc" Set $MinimumSpace$ = "250 MB" Set $InstallDir32$ = "%ProgramFiles32Dir%\Octopus Desk UC" Set $InstallDir64$ = "%ProgramFiles64Dir%\Octopus Desk UC" 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%\delsub3264.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub3264.ins" endif if $LicenseRequired$ = "true" comment "Licensing required, reserve license and get license key" Sub_get_licensekey endif comment "installing" if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") Message "Installing " + $ProductId$ + " 32 Bit..." comment "Start setup program" Winbatch_install_32 Sub_check_exitcode comment "Copy files" Files_install_32 /32Bit endif if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) Message "Installing " + $ProductId$ + " 64 Bit..." comment "Start setup program" Winbatch_install_64 Sub_check_exitcode comment "Copy files" Files_install_64 /64Bit endif endif sleepSeconds 20 [Winbatch_install_32] "%ScriptPath%\setup\Octopus Desk UC Client.msi" /qb! ALLUSERS=2 REBOOT=ReallySuppress [Files_install_32] copy -s "%ScriptPath%\setup\*.*" "$InstallDir32$\setup" [Winbatch_install_64] "%ScriptPath%\setup\Octopus Desk UC Client.msi" /qb! ALLUSERS=2 REBOOT=ReallySuppress [Files_install_64] copy -s "%ScriptPath%\setup\*.*" "$InstallDir64$\setup" [Sub_get_licensekey] 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 isFatalError else if $ServiceErrorClass$ = "LicenseMissingError" LogError "Fatal: required license is not supplied" isFatalError endif endif 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 ==== delsub3264.ins ==== Set $MsiId32$ = '{46DF44F6-BCC1-4B88-84CA-F3DBAAC9552C}' Set $MsiId64$ = '{46DF44F6-BCC1-4B88-84CA-F3DBAAC9552C}' if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") Message "Uninstalling " + $ProductId$ + " 32 Bit..." if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "") comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi_32 sub_check_exitcode endif comment "Delete files" Files_uninstall_32 /32Bit endif if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) Message "Uninstalling " + $ProductId$ + " 64 Bit..." if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "") comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi_64 sub_check_exitcode endif comment "Delete files" Files_uninstall_64 /64Bit endif comment "Delete program shortcuts" LinkFolder_uninstall [Winbatch_uninstall_msi_32] msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress [Files_uninstall_32] delete -sf "$InstallDir32$\" [Winbatch_uninstall_msi_64] msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress [Files_uninstall_64] delete -sf "$InstallDir64$\" [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 ==== uninstall3264.ins ==== [Actions] requiredWinstVersion >= "4.10.8.6" DefVar $MsiId32$ DefVar $UninstallProgram32$ DefVar $MsiId64$ DefVar $UninstallProgram64$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir32$ DefVar $InstallDir64$ DefVar $LicenseRequired$ DefVar $LicensePool$ DefVar $INST_SystemType$ DefVar $INST_architecture$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "octopus-desk-uc" Set $InstallDir32$ = "%ProgramFiles32Dir%\Octopus Desk UC" Set $InstallDir64$ = "%ProgramFiles64Dir%\Octopus Desk UC" Set $LicenseRequired$ = "false" Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ScriptPath%\delsub3264.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub3264.ins" endif if $LicenseRequired$ = "true" comment "Licensing required, free license used" Sub_free_license endif sleepSeconds 20 [Sub_free_license] 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$)