Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

mcore-src/trunk/mcore-tools/daemon/client/include/citrix.client.class revision 2029 by niro, Mon Aug 13 11:37:56 2012 UTC mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in revision 2634 by niro, Tue Sep 29 11:43:12 2015 UTC
# Line 5  provide citrix ica Line 5  provide citrix ica
5  # needs fluxbox!  # needs fluxbox!
6  require fluxbox basic-video  require fluxbox basic-video
7    
8    # citrix global config
9    include @@SYSCONFDIR@@/mcore/citrix.conf
10    
11  help_citrix_serverlist()  help_citrix_serverlist()
12  {  {
13   mecho "get citrix.serverlist"   mecho "get citrix.serverlist [action]"
14   mecho " Shows all hosts added on the serverlist."   mecho " Shows all hosts added on the serverlist."
15     mecho " [actions]:"
16     mecho "   print - prints local configured serverlist"
17     mecho "   query - get serverlist of the farm from given [server]"
18   mecho   mecho
19   mecho "set citrix.serverlist [action] [host]"   mecho "set citrix.serverlist [action] [host]"
20   mecho " Adds or deletes a server from the ica serverlist."   mecho " Adds or deletes a server from the ica serverlist."
21   mecho " [actions]:"   mecho " [actions]:"
22   mecho "   add   - adds a server"   mecho "   add   - adds a server"
23   mecho "   del   - deletes a server"   mecho "   del   - deletes a server"
24     mecho "   auto  - queries given [server] for the serverlist and adds all of them"
25   mecho   mecho
26   mecho "   host  - dns hostname or ip of the server"   mecho "   host  - dns hostname or ip of the server"
27   mecho   mecho
# Line 25  help_citrix_session() Line 32  help_citrix_session()
32  {  {
33   mecho "get citrix.session"   mecho "get citrix.session"
34   mecho " Shows all configured ICA sessions"   mecho " Shows all configured ICA sessions"
35     mecho "   print - prints all local configured sessions"
36     mecho "   query - get sessionlist of the farm from given [server]"
37   mecho   mecho
38   mecho "set citrix.session [action] [session] [mode] [user] [domain] [password]"   mecho "set citrix.session [action] [name] [session] [mode] [user] [domain] [password]"
39   mecho "  Adds or delets a ICA session."   mecho "  Adds or delets a ICA session."
40   mecho "  Available actions:"   mecho "  Available actions:"
41   mecho "   add        - adds a new ica session"   mecho "   add        - adds a new ica session"
42   mecho "   del        - deletes ica session with file name [file]"   mecho "   del        - deletes ica session with name [name]"
43   mecho "                if no [file] given, all sessions will be deleted"   mecho "                if no [name] given, all sessions will be deleted"
44   mecho   mecho
45   mecho "  Available modes:"   mecho "  Available modes:"
46   mecho "   fullscreen - fullscreen session"   mecho "   fullscreen - fullscreen session"
# Line 48  help_citrix_session() Line 57  help_citrix_session()
57    
58  set_citrix_session()  set_citrix_session()
59  {  {
60   local action="$1"   local action="${CLASS_ARGV[0]}"
61   local session="$2"   local name="${CLASS_ARGV[1]}"
62   local mode="$3"   local session="${CLASS_ARGV[2]}"
63   local user="$4"   local mode="${CLASS_ARGV[3]}"
64   local domain="$5"   local user="${CLASS_ARGV[4]}"
65   local password="$6"   local domain="${CLASS_ARGV[5]}"
66   local serverlist   local password="${CLASS_ARGV[6]}"
67   local server   local serverlist="${CLASS_ARGV[7]}"
  local server_num  
  local icafile  
  local CONFIG  
68   local i   local i
69     local opts
70    
71   [[ -z ${action} ]] && help_citrix_session && return 1   [[ -z ${action} ]] && help_citrix_session && return 1
  [[ -z ${session} ]] && help_citrix_session && return 1  
72    
73   case "${action}" in   case "${action}" in
74   add)   add)
75     # requires name
76     [[ -z ${name} ]] && help_citrix_session && return 1
77   # action 'add' need mode too   # action 'add' need mode too
78   [[ -z ${mode} ]] && help_citrix_session && return 1   [[ -z ${mode} ]] && help_citrix_session && return 1
79     # and session
80     [[ -z ${session} ]] && help_citrix_session && return 1
81    
82   # other sanity checks   # other sanity checks
83   case "${mode}" in   case "${mode}" in
84   fullscreen) ;;   fullscreen) ;;
85   seamless) ;;   seamless) ;;
86   *x*) ;;   *x*) ;;
87   *) help_citrix_session && return 1   *) help_citrix_session && return 1 ;;
88   esac   esac
89    
90   icafile="${MCORE_CONFIG_PATH}/citrix/ica/${session}.ica"   if [[ -n ${serverlist} ]]
91   CONFIG="${MROOT}/${icafile}"   then
92   clearconfig   opts="--serverlist '${serverlist}'"
93     fi
  addconfig '[WFClient]'  
  addconfig 'Version=2'  
   
  serverlist=$(NOCOLORS=true get_citrix_serverlist)  
  declare -i i=0  
  for server in ${serverlist}  
  do  
  (( i++ ))  
  server_num="${i}"  
  [[ ${i} -eq 1 ]] && server_num=""  
  addconfig "TcpBrowserAddress${server_num}=${server}"  
  done  
  addconfig 'ScreenPercent=0'  
  addconfig '[ApplicationServers]'  
  addconfig "${session}="  
  addconfig "[${session}]"  
  addconfig "Address=${session}"  
  addconfig "InitialProgram=#${session}"  
   
  # mapping table xorg -> citrix  
  # citrix 1 = 16 colors  
  # citrix 2 = 256 colors  
  # citrix 4 = 16 bit  
  # citrix 8 = 32 bit  
  # try always 16 bit  
  addconfig "DesiredColor=4"  
   
  addconfig 'TransportDriver=TCP/IP'  
  addconfig 'WinStationDriver=ICA 3.0'  
   
  [[ -n ${user} ]] && addconfig "Username=${user}"  
  [[ -n ${domain} ]] && addconfig "Domain=${domain}"  
  [[ -n ${password} ]] && addconfig "ClearPassword=${password}"  
   
  # use the right display settings  
  case "${mode}" in  
  # fullscreen mode  
  fullscreen)  
  addconfig 'UseFullScreen=Yes'  
  addconfig 'NoWindowManager=True'  
  addconfig "DesiredHRES=65535"  
  addconfig "DesiredVRES=65535"  
  ;;  
  # seamless window mode  
  seamless)  
  addconfig 'TWIMode=On'  
  ;;  
  # a desired resolution  
  *x*)  
  addconfig "DesiredHRES=${mode%x*}"  
  addconfig "DesiredVRES=${mode#*x}"  
  ;;  
  esac  
94    
95   # generate fluxbox menu entry   # create citrix session file
96   set_fluxbox_menuitem add "${session}" "wfica ${icafile}"   ${MCORE_LIBDIR}/citrix-session \
97     --add \
98     --name "${name}" \
99     --session "${session}" \
100     --mode "${mode}" \
101     --user "${user}" \
102     --domain "${domain}" \
103     --password "${password}" \
104     ${opts}
105   ;;   ;;
106    
107   del)   del)
108   if [ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica/"${session}".ica ]   if [[ -n ${name} ]]
109   then   then
110   rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica/"${session}".ica   ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
111   set_fluxbox_menuitem del "${session}"   else
112     for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-session --print)
  elif [[ -z ${file} ]]  
  then  
  # delete all items, needed to loop through every session  
  # or we delete *all* fluxbox menuitem too  
  for i in $(find ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica -type f)  
113   do   do
114   rm ${i}   # basename
115   set_fluxbox_menuitem del "$(basename ${i} .ica)"   name="${i%.*}"
116     ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
117   done   done
118   fi   fi
119   ;;   ;;
# Line 163  set_citrix_session() Line 124  set_citrix_session()
124    
125  get_citrix_session()  get_citrix_session()
126  {  {
127   list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica   local action="${CLASS_ARGV[0]}"
128    
129     [[ -z ${action} ]] && help_citrix_serverlist && return 1
130    
131     case "${action}" in
132     print) ${MCORE_LIBDIR}/citrix-session --print ;;
133     query) ${MCORE_LIBDIR}/citrix-session --query ;;
134     *) help_citrix_session && return 1 ;;
135     esac
136  }  }
137    
138  set_citrix_serverlist()  set_citrix_serverlist()
139  {  {
140   local action="$1"   local action="${CLASS_ARGV[0]}"
141   local server="$2"   local server="${CLASS_ARGV[1]}"
142   local CONFIG   local i
143    
144   [[ -z ${action} ]] && help_citrix_serverlist && return 1   [[ -z ${action} ]] && help_citrix_serverlist && return 1
145    
146   case "${action}" in   case "${action}" in
147   add)   add) ${MCORE_LIBDIR}/citrix-serverlist --add --server "${server}" ;;
  [[ -z ${server} ]] && help_citrix_serverlist && return 1  
  CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/${server}"  
  clearconfig  
  addconfig "${server}"  
  ;;  
   
148   del)   del)
149   if [[ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/${server} ]]   if [[ -n ${server} ]]
  then  
  rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/"${server}"  
  elif [[ -z ${server} ]]  
150   then   then
151     ${MCORE_LIBDIR}/citrix-serverlist --del --server "${server}"
152     else
153   # delete all items   # delete all items
154   find ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist -type f | xargs --no-run-if-empty rm   for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-serverlist --print)
155     do
156     ${MCORE_LIBDIR}/citrix-serverlist --del --server "${i}"
157     done
158   fi   fi
159   ;;   ;;
160     auto) ${MCORE_LIBDIR}/citrix-serverlist --auto ;;
161   *) help_citrix_serverlist && return 1 ;;   *) help_citrix_serverlist && return 1 ;;
162   esac   esac
163  }  }
164    
165  get_citrix_serverlist()  get_citrix_serverlist()
166  {  {
167   list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist   local action="${CLASS_ARGV[0]}"
168    
169     [[ -z ${action} ]] && help_citrix_serverlist && return 1
170    
171     case "${action}" in
172     print) ${MCORE_LIBDIR}/citrix-serverlist --print ;;
173     query) ${MCORE_LIBDIR}/citrix-serverlist --query ;;
174     *) help_citrix_session && return 1 ;;
175     esac
176  }  }

Legend:
Removed from v.2029  
changed lines
  Added in v.2634