#!/bin/bash CMD="$1" USER="$2" PASS="$3" DOMAIN="$4" APP="$5" BROWSER="" : ${STORE=""} if [[ -z ${STORE} ]] then source /etc/alxconfig-ng/storefront.rc fi # prefer storebrowse if [[ -e ${ICAROOT}/util/storebrowse ]] then BROWSER=${ICAROOT}/util/storebrowse # use old pnabrowse elif [[ -e ${ICAROOT}/util/pnabrowse ]] then BROWSER=${ICAROOT}/util/pnabrowse else echo "No Citrix browser found." exit 1 fi USE_XMESSAGE=0 if [[ -x $(type -P xmessage) ]] then USE_XMESSAGE=1 fi storefront_enumerate() { "${BROWSER}" -E -U "${USER}" -P "${PASS}" -D "${DOMAIN}" "${STORE}" } storefront_launch() { "${BROWSER}" -L "${APP}" -U "${USER}" -P "${PASS}" -D "${DOMAIN}" "${STORE}" } case ${CMD} in enumerate) # enumerate apps storefront_enumerate ;; launch) # launch apps if [[ ${USE_XMESSAGE} = 1 ]] then xmessage -center -title "ICA-Client" -buttons "" " Starting session '${APP}' ... " & fi # always enumerate all apps to fill the cache or launch will not work # and always enumerate if the cache is older than one day if [ ! -f ~/.ICAClient/cache/Citrix/PNAgent/AppCache/appdata.xml ] || [[ ! -z $(find ~/.ICAClient/cache/Citrix/PNAgent/AppCache/appdata.xml -mtime +1) ]] then storefront_enumerate fi if storefront_launch then if [[ ${USE_XMESSAGE} = 1 ]] then killall xmessage fi else if [[ ${USE_XMESSAGE} = 1 ]] then killall xmessage xmessage -center -title "ICA-Client" -buttons " Abort" "Failed to start session '${APP}'. " & else echo "Failed to start session '${APP}'." fi fi ;; *) echo "Unknown command '${CMD}'." exit 1 ;; esac