How to Install Citrix Receiver 12.8 Via login trigger or self service and avoid "failed" Status in policy log

djdavetrouble
Contributor III

Been batting this one around for a few weeks, and finally discovered that Citrix has silently put in a mechanism to deal with their faulty script. The script runs properly when double clicking a pkg, but fails when run from management. To get around this, the installer looks for an Installing user parameter in a text file that we will happily provide using JAMF built in variables.

  1. Put Install Citrix Receiver 12.8.pkg as the package payload.
  2. Create a script with the following and add it as a script payload to run BEFORE:
#!/bin/bash

#########InstallOptions.txt creation
cat > /Library/Application Support/Citrix Receiver/InstallOptions.txt <<EOF

INSTALLING_USER=$3

EOF

Policy must be either self service or login trigger due to the use of $3 variable.
I hope this helps, I know I was pulling my hair out.

thanks to mark_lamont on macadmins slack for the info.

10 REPLIES 10

al_platt
Contributor II

Awesome work, will try this now... always get hammered by failed policy emails when upading or installing!

mscottblake
Valued Contributor

What happens if you set INSTALLING_USER to root instead of $3?

djdavetrouble
Contributor III

Well depending on your environment, the user it is supposed to be installed for will be missing some functionality. Lets dissect the script in question to find out:

#!/bin/bash

# Uncomment set-x to get verbose logging in the console
#set -x

LOG_FILE_PATH="$HOME/Library/Logs/ReceiverInstall.log"
DAZZLE_APPS_FOLDER="/Applications/Dazzle"
DAZZLE_APPS_FOLDER_LEN=$(echo ${#DAZZLE_APPS_FOLDER})
DAZZLE_APPS_FOLDER_LEN=$((DAZZLE_APPS_FOLDER_LEN + 1)) # +1 for the trailing slash
USER_SHARED_APP_DIR="/Users/Shared/Citrix Receiver"
PLUGINS_DIR="/Library/Application Support/Citrix/PlugIns"
INSTALL_OPTIONS_FILE="/Library/Application Support/Citrix Receiver/InstallOptions.txt"
INSTALLING_USER=
INSTALLING_USER_UID=
INSTALLING_USER_HOME=

writeLog() {
    echo "$@" >> "$LOG_FILE_PATH"
}

checkError() {
    local err=$?
    if [ $err -ne 0 ] ; then
        writeLog "ERROR ($err): $1"
        writeLog ""
        writeLog ""
        exit 1
    fi
}

#
# $1 - The name under which this agent is to be installed,
#
configureAgent() {
    local plist_path="/Library/LaunchAgents/com.citrix.$1.plist"

    # launchctl is fussy about the ownership and permissions on the launchd plists.
    # This from the man page:
    #   Note that per-user configuration files (LaunchAgents) must be owned by the user
    #   loading them. All system-wide daemons (Launch-Daemons) must be owned by root.
    #   Configuration files must not be group- or world-writable. These restrictions are in
    #   place for security reasons, as allowing writability to a launchd configuration
    #   file allows one to specify which executable will be launched.
    #   Note that allowing non-root write access to the /System/Library/LaunchDaemons
    #   directory WILL render your system unbootable.
    chown root:wheel "$plist_path"
    checkError "Failed setting launchd agent plist ownership"

    chmod 644 "$plist_path"
    checkError "Failed setting launchd agent plist permissions"

    # Load the  launchd plists. The unload is allowed to fail. launchctl has
    # to be run as the correct user if this was a user install, or as root
    # if this was a system install. If this was a system install then we
    # expect to be running as root anyway.
    su -l "$INSTALLING_USER" -c "launchctl unload -wF -S Aqua "$plist_path""
    su -l "$INSTALLING_USER" -c "launchctl load -wF -S Aqua "$plist_path""
    checkError "launchctl failed loading agent"
}

#
# $1 - The name under which this agent is to be installed,
#
configureDaemon() {
    local plist_path="/Library/LaunchDaemons/com.citrix.$1.plist"
    chown root:wheel "$plist_path"
    checkError "Failed setting launchd daemon plist ownership"
    chmod 644 "$plist_path"
    checkError "Failed setting launchd daemon plist permissions"
    launchctl unload -wF "$plist_path"
    launchctl load -wF "$plist_path"
    checkError "launchctl failed loading daemon"
}

readInstallOption() {
    sed -n -e "s/^$1=(.*).*$/1/p" "$INSTALL_OPTIONS_FILE" 2>/dev/null
}

readInstallOptions() {

    # Check to see if there is an InstallOptions.txt file
    if [ -e "$INSTALL_OPTIONS_FILE" ]; then

        writeLog "Install Options:"
        cat "$INSTALL_OPTIONS_FILE" >> "$LOG_FILE_PATH"
        writeLog ""
        writeLog ""

        INSTALLING_USER=$(readInstallOption "INSTALLING_USER")
        INSTALLING_USER_HOME=$(readInstallOption "INSTALLING_USER_HOME")
    fi

    if [[ "$INSTALLING_USER" == "" ]]; then
        writeLog "No INSTALLING_USER install option. Getting INSTALLING_USER from $HOME"

        # Couldn't get it... get it from the home directory
        INSTALLING_USER=$(stat -f "%Su" "$HOME")
    fi

    if [[ "$INSTALLING_USER_HOME" == "" ]]; then
        writeLog "No INSTALLING_USER_HOME install option. Setting INSTALLING_USER_HOME to $HOME"
        INSTALLING_USER_HOME="$HOME"
    fi
}

checkMoveLogFile() {
    # If INSTALLING_USER_HOME is not the same as HOME, then we are going to
    # move the log file
    if [[ "$INSTALLING_USER_HOME" != "$HOME" ]]; then
        local newLogDir="$INSTALLING_USER_HOME/Library/Logs"
        local newLogFilePath="$newLogDir/ReceiverInstall.log"

        writeLog "Moving log file path from $LOG_FILE_PATH to $newLogDir"

        # First check to see if there is a log at the location we are moving to
        # If so, then append and delete. Otherwise move.
        if [ -e "$newLogFilePath" ]; then
            cat "$LOG_FILE_PATH" >> "$newLogFilePath"
            if [ $? -eq 0 ]; then
                rm "$LOG_FILE_PATH"
                LOG_FILE_PATH="$newLogFilePath"
            else
                writeLog "Failed to append contents of log file to existing log file at $newLogFilePath"
            fi
        else
            mv "$LOG_FILE_PATH" "$newLogDir"
            if [ $? -eq 0 ]; then
                LOG_FILE_PATH="$newLogFilePath"
            else
                writeLog "Failed to move log file"
            fi
        fi
    fi
}

#==============================================================================================
#  S C R I P T   S T A R T S   H E R E
#==============================================================================================

writeLog "Starting install at $(date)"
writeLog ""

# Dump the env
writeLog "Dumping environment:"
printenv >> "$LOG_FILE_PATH"
writeLog ""

# Dump the arguments
writeLog "Dumping $# Arguments:"
for ((i=1;i<=$#;i++)); do
    writeLog "  Arg $i: ${!i}"
done
writeLog ""

readInstallOptions
checkMoveLogFile
INSTALLING_USER_UID=$(id -u $INSTALLING_USER)
writeLog "Installing as user: $INSTALLING_USER ($INSTALLING_USER_UID)"

USER_RECEIVER_APP_SUPPORT_DIR="$INSTALLING_USER_HOME/Library/Application Support/Citrix Receiver"

# If this is an upgrade, the preinstall script will have created a
# flag file in the same directory as this script. Just checked for it's
# existance.
UPGRADE_VERSION=""
if [ -e "./IsUpgrade" ]; then
    UPGRADE_VERSION=$(cat ./IsUpgrade)
fi
writeLog "UPGRADE_VERSION=$UPGRADE_VERSION"
writeLog "COMMAND_LINE_INSTALL=$COMMAND_LINE_INSTALL"

if [ -e "./install_helper" ]; then
    # Call out to install helper to write out the CEIP data for the install
    # UPGRADE_VERSION contains the version that we are upgrading from
    # COMMAND_LINE_INSTALL != "" indicates that this is a silent install

    INSTALL_HELPER_ARGS="--verbose"

    # Switch --install-type. Valid values are UI/silent
    if [[ "$COMMAND_LINE_INSTALL" != "" ]]; then
        INSTALL_HELPER_ARGS="$INSTALL_HELPER_ARGS --install-type silent"
    else
        INSTALL_HELPER_ARGS="$INSTALL_HELPER_ARGS --install-type UI"
    fi

    # Switch --install-state. Valid values are fresh/upgrade. If it is an upgrade
    # then switch --receiver-previous-version should be present.
    if [[ "$UPGRADE_VERSION" == "" ]]; then
        INSTALL_HELPER_ARGS="$INSTALL_HELPER_ARGS --install-state fresh"
    else
        INSTALL_HELPER_ARGS="$INSTALL_HELPER_ARGS --install-state upgrade --receiver-previous-version $UPGRADE_VERSION"
    fi

    sudo -u "$INSTALLING_USER" ./install_helper $INSTALL_HELPER_ARGS
else
    writeLog "install_helper not found!"
fi

if [ -d "/usr/local/libexec" ]; then
    writeLog "Setting permissions on /usr/local/libexec"
    chmod 755 /usr/local/libexec
    checkError "chmod failed for /usr/local/libexec"
else
    writeLog "WARNING: /usr/local/libexec does not exist!"
fi

writeLog "Configuring AuthManager agent"
configureAgent "AuthManager_Mac"

writeLog "Configuring ServiceRecords agent"
configureAgent "ServiceRecords"

writeLog "Configuring ReceiverHelper agent"
configureAgent "ReceiverHelper"

writeLog "Configuring ctxusbd daemon"
configureDaemon "ctxusbd"

writeLog "Stopping any running Citrix Receiver Launchers"
killall "Citrix Receiver Launcher"

# Make sure that the kext has the correct owner and perms
chown -R root:wheel "/Library/Application Support/Citrix Receiver/CitrixGUSB.kext"
chmod -R 755 "/Library/Application Support/Citrix Receiver/CitrixGUSB.kext"

# Delete the old kernel extension
rm -rf "/Library/Extensions/CitrixGUSB.kext"

# Delete the old shared module directory
rm -rf "/Users/Shared/Citrix/Modules"

# Remove older versions of the client (Version 10)
rm -rf "/Applications/Citrix ICA Client/Citrix ICA Client Editor.app"
rm -rf "/Applications/Citrix ICA Client/Citrix online plug-in.app"
rm -rf "/Applications/Citrix ICA Client/Citrix ICA Client.app"
rm -rf "/Applications/Citrix ICA Client/Citrix ICA EULA.rtf"
rm -rf "/Applications/Citrix ICA Client/ReadMe.html"
rm -rf "/Library/Receipts/Citrix ICA Client.pkg"
rmdir "/Applications/Citrix ICA Client"

# Remove Version 11.0 (may need to move this to preflight)
rm -rf  "/Applications/Citrix Dazzle.app"

# Remove Beta versions of the client (Version 11.2)
rm -rf "/Library/Application Support/Citrix/XenDesktop Viewer.app"
rm -rf "/Library/Application Support/Citrix/XenApp Viewer.app"

# Create app support directories
mkdir -p "/Library/Application Support/Citrix"
chmod 775 "/Library/Application Support/Citrix"
sudo -u "$INSTALLING_USER" mkdir -p "$INSTALLING_USER_HOME/Library/Application Support/Citrix"

# Create the per-user app support
if [ ! -e "$USER_RECEIVER_APP_SUPPORT_DIR" ]; then
    writeLog "Creating app support dir: $USER_RECEIVER_APP_SUPPORT_DIR"
    sudo -u "$INSTALLING_USER" mkdir -p "$USER_RECEIVER_APP_SUPPORT_DIR"
else
    # Already exists, make sure that the owner is correct
    writeLog "Updating owner to $INSTALLING_USER:staff on app support dir: $USER_RECEIVER_APP_SUPPORT_DIR"
    chown -R "$INSTALLING_USER:staff" "$USER_RECEIVER_APP_SUPPORT_DIR"
fi

# Create the Citrix Receiver under shared directory
if [ ! -e "$USER_SHARED_APP_DIR" ]; then
    writeLog "Creating Citrix Receiver dir: $USER_SHARED_APP_DIR"
    sudo -u "$INSTALLING_USER" mkdir -p "$USER_SHARED_APP_DIR"
else
    # Already exists, make sure that the owner is correct
    writeLog "Updating owner to $INSTALLING_USER:staff on user shared app dir: $USER_SHARED_APP_DIR"
    chown -R "$INSTALLING_USER:staff" "$USER_SHARED_APP_DIR"
fi

# Permissions: rwxr-xr-x
writeLog "Setting permissions to 755 on app support dir: $USER_RECEIVER_APP_SUPPORT_DIR"
chmod 755 "$USER_RECEIVER_APP_SUPPORT_DIR"
writeLog "Setting permissions to 755 on user shared app dir: $USER_SHARED_APP_DIR"
chmod 755 "$USER_SHARED_APP_DIR"


# If the Config/Modules/ViewerLogging.plist files don't exist, copy the defaults
if [ ! -e "$USER_RECEIVER_APP_SUPPORT_DIR/Config" ]; then
    writeLog "Copying default Config file to: $USER_RECEIVER_APP_SUPPORT_DIR"
    sudo -u "$INSTALLING_USER" cp "/Applications/Citrix Receiver.app/Contents/Helpers/Citrix Viewer.app/Contents/Resources/Config" "$USER_RECEIVER_APP_SUPPORT_DIR"
fi
if [ ! -e "$USER_RECEIVER_APP_SUPPORT_DIR/Modules" ]; then
    writeLog "Copying default Modules file to: $USER_RECEIVER_APP_SUPPORT_DIR"
    sudo -u "$INSTALLING_USER" cp "/Applications/Citrix Receiver.app/Contents/Helpers/Citrix Viewer.app/Contents/Resources/Modules" "$USER_RECEIVER_APP_SUPPORT_DIR"
fi
if [ ! -e "$USER_RECEIVER_APP_SUPPORT_DIR/ViewerLogging.plist" ]; then
    writeLog "Copying default ViewerLogging.plist file to: $USER_RECEIVER_APP_SUPPORT_DIR"
    sudo -u "$INSTALLING_USER" cp "/Applications/Citrix Receiver.app/Contents/Frameworks/ICAServices.framework/Resources/ViewerLogging.plist" "$USER_RECEIVER_APP_SUPPORT_DIR"
fi

# If the CtxLogger.plist files don't exist, copy the defaults
if [ ! -e "$USER_SHARED_APP_DIR/CtxLogger.plist" ]; then
    writeLog "Copying default CtxLogger.plist file to: $USER_SHARED_APP_DIR"
    sudo -u "$INSTALLING_USER" cp "/Applications/Citrix Receiver.app/Contents/Frameworks/CtxLogger.framework/Resources/CtxLogger.plist" "$USER_SHARED_APP_DIR"
fi

# Copy the usb.conf file into /Library/Application Support/Citrix Receiver if it doesn't exist
if [ ! -e "/Library/Application Support/Citrix Receiver/usb.conf" ]; then
    writeLog "Copying usb.conf to /Library/Application Support/Citrix Receiver"
    cp "./usb.conf" "/Library/Application Support/Citrix Receiver"
fi

# Create PlugIn directories. If they already exist, make sure that the owner and
# permissions are correct
if [ ! -d "$PLUGINS_DIR" ]; then
    writeLog "Creating $PLUGINS_DIR"
    mkdir -p "$PLUGINS_DIR"
fi
chmod 0755 "$PLUGINS_DIR"
chown root:wheel "$PLUGINS_DIR"

INSTALLING_USER_PLUGINS_DIR="$INSTALLING_USER_HOME$PLUGINS_DIR"
if [ ! -d "$INSTALLING_USER_PLUGINS_DIR" ]; then
    writeLog "Creating $INSTALLING_USER_PLUGINS_DIR"
    sudo -u "$INSTALLING_USER" mkdir -p "$INSTALLING_USER_PLUGINS_DIR"
fi
sudo -u "$INSTALLING_USER" chmod 0755 "$INSTALLING_USER_PLUGINS_DIR"
sudo -u "$INSTALLING_USER" chown "$INSTALLING_USER:staff" "$INSTALLING_USER_PLUGINS_DIR"

# Give the integration file everyone read/write so Receiver updater can remove it when done
chmod -R a+rw "/Users/Shared/Citrix/Receiver Integration"

# Migrate older Config/Modules preferences (~/Library/Preferences/Citrix ICA Client) to the new location
sudo -u "$INSTALLING_USER" mv -n "$INSTALLING_USER_HOME/Library/Preferences/Citrix ICA Client/Config" "$USER_RECEIVER_APP_SUPPORT_DIR/Config"
sudo -u "$INSTALLING_USER" mv -n "$INSTALLING_USER_HOME/Library/Preferences/Citrix ICA Client/Modules" "$USER_RECEIVER_APP_SUPPORT_DIR/Modules"
rm -rf "$INSTALLING_USER_HOME/Library/Preferences/Citrix ICA Client"

# Migrate older subscriptions from /Applications/Dazzle
#
# This lovely bit of script will go through /Applications/Dazzle and it's subdirectories
# looking for subscriptions. They will get moved into ~/Applications in the same relative
# locations. Any non-subscription apps that are in /Applications/Dazzle will be left alone.
# After moving any subscriptions, all non-empty subdirectories of /Applications/Dazzle will
# be deleted. Finally, if /Applications/Dazzle is empty, it will be deleted as well.
UPGRADE_SUBS=0
SAVEIFS=$IFS
IFS=$(echo -en "
")
files=$(find "$DAZZLE_APPS_FOLDER" -type d -name "*.app")
for f in $files; do
    plist="$f/Contents/Info"
    bundleID=$(defaults read "$plist" CFBundleIdentifier)
    if [[ $bundleID == com.citrix.XenAppAlias-* || $bundleID == com.citrix.XenDesktopAlias-* ]]; then
        writeLog "Found subscription at $f"
        relativePath=${f:DAZZLE_APPS_FOLDER_LEN}
        relativeDir=$(dirname "$relativePath")
        if [ ! -d "$INSTALLING_USER_HOME/Applications/$relativePath" ]; then
            writeLog "   Migrating subscription $f to $INSTALLING_USER_HOME/Applications/$relativePath"
            sudo -u "$INSTALLING_USER" mkdir -p "$INSTALLING_USER_HOME/Applications/$relativeDir"
            sudo -u "$INSTALLING_USER" mv -n "$f" "$INSTALLING_USER_HOME/Applications/$relativeDir"
            UPGRADE_SUBS=1
        else
            writeLog "   Subscription at $f already exists in $INSTALLING_USER_HOME/Applications/$relativePath"
            rm -rf "$f"
        fi
    else
        writeLog "App at $f is NOT a subscription"
    fi
done
IFS=$SAVEIFS
find "/Applications/Dazzle" -type d -mindepth 1 -empty -delete
rm -f "/Applications/Dazzle/.DS_Store"
rmdir "/Applications/Dazzle"

# Remove older versions of the client (Version 11.2)
rm -rf "/Applications/Citrix/Dazzle.app"
rm -f "/Applications/Citrix/.DS_Store"
rmdir "/Applications/Citrix"
rm -rf "/Library/Application Support/Citrix/DockApplication.app"
rm -rf "/Library/Application Support/Citrix/Citrix Online Web Plug-in.app"
rm -rf "/Library/Application Support/Citrix/Desktop Viewer.app"
rm -rf "/Library/Application Support/Citrix/Citrix Online Plug-in.app"
rm -rf "/Library/Application Support/Citrix/DazzleMe.app"
rm -rf "/Library/Application Support/Citrix/Uninstall Citrix Online Plug-in.app"
rm -f "/Library/Application Support/Citrix/.DS_Store"
rmdir "/Library/Application Support/Citrix"
rm -rf "/Library/PreferencePanes/Citrix Online Plug-in.prefpane"
rm -rf "/Library/Receipts/Install Citrix Online Plug-in.pkg"

# 11.2 was taken care of above. For 11.3 MAS, subscriptions are in the right place but
# they still need to be upgraded. If we didn't do any migrations for 11.2, check ~/Applications
# and see if there are any subscriptions there. If so, mark the flag so that they will
# get upgraded later.
if [ $UPGRADE_SUBS -eq 0 ]; then
    SAVEIFS=$IFS
    IFS=$(echo -en "
")
    files=$(sudo -u "$INSTALLING_USER" find "$INSTALLING_USER_HOME/Applications" -type d -name "*.app")
    for f in $files; do
        plist="$f/Contents/Info"
        bundleID=$(defaults read "$plist" CFBundleIdentifier)
        if [[ $bundleID == com.citrix.XenAppAlias-* || $bundleID == com.citrix.XenDesktopAlias-* ]]; then
            writeLog "Found at least one subscription in ~/Applications..."
            UPGRADE_SUBS=1
            break
        fi
    done
    IFS=$SAVEIFS
fi

# Remove older versions of the client (Version 11.3)
rm -rf "$INSTALLING_USER_HOME/Library/Internet Plug-Ins/CitrixICAClientPlugIn.plugin"

# remove the older preferences
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.ApplicationReconnect.plist"
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.Citrix_Dazzle.plist"
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.DockApplication.plist"
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.ICAClient.plist"
rm -f "$INSTALLING_USER_HOME"/Library/Preferences/com.citrix.XenAppAlias*
rm -f "$INSTALLING_USER_HOME"/Library/Preferences/com.citrix.XenDesktopAlias*
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.XenAppViewer.plist"
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.XenDesktopViewer.plist"
rm -f "$INSTALLING_USER_HOME/Library/Preferences/com.citrix.receiver.mas.plist"

# If FMD is installed, remove it now. The presense of the Uninstaller
# is used to determine if it should be removed.
FMD_IN_USE=0
FMD_DOCS_PATH="$INSTALLING_USER_HOME/ShareFile"
FMD_UNINSTALLER="/Applications/Citrix/FollowMeData/Uninstall ShareFile Plug-in.app/Contents/Resources/PreviledgedTool"
if [ -e "$FMD_UNINSTALLER" ]; then

    # FMD is installed... let's see if the user was actually using it. To do
    # this we check to see if ~/ShareFile exists and is not empty. Excluding
    # .DS_Store, of course.
    existingFMDData=$(sudo -u "$INSTALLING_USER" find "$FMD_DOCS_PATH" -type f ( ! -iname ".DS_Store" ))
    if [ "$existingFMDData" != "" ]; then
        FMD_IN_USE=1
    fi

    writeLog "FMD install detected. Uninstalling..."
    "$FMD_UNINSTALLER"
    writeLog "FMD uninstall complete."
fi

writeLog "UPGRADE_SUBS=$UPGRADE_SUBS"
writeLog "FMD_IN_USE=$FMD_IN_USE"

if [[ $UPGRADE_VERSION != "" || "$COMMAND_LINE_INSTALL" != "" ]]; then
    RECEIVER_ARGS=""
    if [ $UPGRADE_SUBS -eq 1 ]; then
        writeLog "Launching Receiver to upgrade subscriptions..."
        RECEIVER_ARGS="$RECEIVER_ARGS --upgrade-subs"
    fi
    if [ $FMD_IN_USE -eq 1 ]; then
        writeLog "Launching Receiver to show FMD warning..."
        RECEIVER_ARGS="$RECEIVER_ARGS --show-fmd-warning"
    fi

    if [ "$RECEIVER_ARGS" != "" ]; then

        if [ "$COMMAND_LINE_INSTALL" != "" ]; then
            RECEIVER_ARGS="$RECEIVER_ARGS --quiet"
        fi

        # We have subscriptions that potentially need to be upgraded. Launch Receiver with the upgrade command-line
        writeLog "Launching Receiver install step with command-line args: $RECEIVER_ARGS"
        sudo -u "$INSTALLING_USER" "/Applications/Citrix Receiver.app/Contents/MacOS/Citrix Receiver" $RECEIVER_ARGS
        wait $!
        writeLog "Receiver install step complete"
    fi
fi

writeLog ""
writeLog ""

exit 0

discounteggroll
New Contributor III

Thanks djdavetrouble, this works for 12.9 as well. RIP my inbox for false-positive failures, only wished I saw this sooner =/

Just_Jack
Contributor

I'm late to the game.
When you say:
"Create a script with the following and add it as a script payload to run BEFORE:"
This script created in Jamf Pro or add this script in the PKG using Composer?

marklamont
Contributor III

in his post @djdavetrouble is saying add this script in the policy that is used to install the standard Citrix package. `That way it's populated before the package runs and uses the information in it.
You could make your own package of course that did ran a similar script to create the file, remember $3 is simply the logged in user, then ran the standard package from within itself.

burdett
Contributor II

I could not get the $3 to work so I used the following script

#!/bin/bash

#########InstallOptions.txt creation
curUser=`ls -l /dev/console | cut -d " " -f 4`
cat > /Library/Application Support/Citrix Receiver/InstallOptions.txt <<EOF

INSTALLING_USER=$curUser

EOF

maziboss
New Contributor

What can we set in Citrix using InstallOptions.txt file? Could you show me some examples?

marklamont
Contributor III

that's it as far as we know, the user to install as. The example is above.

thomas-cedar
New Contributor II

For those that are installing Citrix Receiver on new computers, you may need to modify the script to create the relevant directories. IE add the following line to the script before the line that cats the new file:

mkdir -p /Library/Application Support/Citrix Receiver

Otherwise you'll probably run into an error saying that the directory/file doesn't exist