Table of Contents

CitrixReceiver

Tested with opsi 4.0.1
requiredWinstVersion >= 4.10.8.6
CitrixReceiver can be downloaded at https://www.citrix.de/downloads/citrix-receiver/windows/receiver-for-windows-latest.html
ReceiverCleanupUtility can be downloaded at https://www.thinfactory.com/content/citrix-receiver-clean-utility

By Thomas_H 2017/12/06 12:45 (Nikolausi!!)

Tree:

CLIENT_DATA
  ├ CitrixReceiver.exe
  ├ CitrixReceiver.jpg
  ├ ReceiverCleanupUtility.exe
  ├ delsub.ins
  ├ setup.ins
  └ uninstall.ins

setup.ins

requiredWinstVersion >= "4.10.8.6"
 
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $ExitCode$
 
;#############################################################
;##########                     Set Variables       ##########
;#############################################################
 
Set $LogDir$            = "%SystemDrive%\tmp"
Set $ProductId$         = "CitrixReceiver"
Set $MinimumSpace$      = "50 MB"
 
 
;#############################################################
;##########     Check Systemrequirements            ##########
;#############################################################
 
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%\CitrixReceiver.jpg" $ProductId$
endif
 
;#############################################################
;##########             Start Installation Script   ##########
;#############################################################
 
Message "Alten Citrix-Client vorsorglich entfernen..."
Winbatch_uninstall
 
Message "Citrix-Client installieren..."
Winbatch_install
 
Sub_check_exitcode
 
;#############################################################
;##########             Installation Script         ##########
;#############################################################
 
[Winbatch_uninstall]
"%Scriptpath%\ReceiverCleanupUtility.exe" /silent
 
[Winbatch_install]
"%ScriptPath%\CitrixReceiver.exe" /silent
 
[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
;#############################################################
;##########                     End of Script
##########
;#############################################################

uninstall.ins

[Initial]
LogLevel=9
;  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
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $Uninst_Cmd$
DefVar $Uninst_Prg$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "CitrixReceiver"
Set $Uninst_Prg$        = "%ScriptPath%\ReceiverCleanupUtility.exe"
Set $Uninst_Cmd$        = ' /silent'
; ----------------------------------------------------------------
 
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".jpg" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub.ins")
        comment "Start uninstall sub section"
        Sub "%ScriptPath%\delsub.ins"
endif
 
; 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$)

delsub.ins

 
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
        Message "Uninstalling " + $ProductId$
 
        if FileExists($Uninst_Prg$)
                comment "Uninstall program found, starting uninstall"
                Winbatch_uninstall
                comment "Removing "+$InstallDir$
                Files_uninstall
                sub_check_exitcode
        endif
endif
 
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
        Message "Uninstalling " + $ProductId$
 
        if FileExists($Uninst_Prg$)
 
                comment "Uninstall program found, starting uninstall"
                Winbatch_uninstall
                comment "Removing "+$InstallDir$
                Files_uninstall
                sub_check_exitcode
        endif
endif
 
[Winbatch_uninstall]
"$Uninst_Prg$" $Uninst_Cmd$
 
[Files_uninstall]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
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