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 1266 by niro, Fri Feb 4 20:14:58 2011 UTC mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in revision 2276 by niro, Tue Jan 14 13:31:36 2014 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]}"
  local server  
  local server_num  
  local CONFIG  
67   local i   local i
68    
69   [[ -z ${action} ]] && help_citrix_session && return 1   [[ -z ${action} ]] && help_citrix_session && return 1
  [[ -z ${session} ]] && help_citrix_session && return 1  
70    
71   case "${action}" in   case "${action}" in
72   add)   add)
73     # requires name
74     [[ -z ${name} ]] && help_citrix_session && return 1
75   # action 'add' need mode too   # action 'add' need mode too
76   [[ -z ${mode} ]] && help_citrix_session && return 1   [[ -z ${mode} ]] && help_citrix_session && return 1
77     # and session
78     [[ -z ${session} ]] && help_citrix_session && return 1
79    
80   # other sanity checks   # other sanity checks
81   case "${mode}" in   case "${mode}" in
82   fullscreen) ;;   fullscreen) ;;
83   seamless) ;;   seamless) ;;
84   *x*) ;;   *x*) ;;
85   *) help_citrix_session && return 1   *) help_citrix_session && return 1 ;;
86   esac   esac
87    
88   CONFIG="${MCORE_CONFIG_PATH}/citrix/ica/${session}.ica"   # create citrix session file
89   clearconfig   ${MCORE_LIBDIR}/citrix-session \
90     --add \
91   addconfig '[WFClient]'   --name "${name}" \
92   addconfig 'Version=2'   --session "${session}" \
93     --mode "${mode}" \
94   serverlist=$(NOCOLORS=true get_citrix_serverlist)   --user "${user}" \
95   declare -i i=0   --domain "${domain}" \
96   for server in ${serverlist}   --password "${password}"
  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  
97    
98   # generate fluxbox menu entry   # generate fluxbox menu entry
99   set_fluxbox_menuitem add "${session}" "wfica ${CONFIG}"   set_fluxbox_menuitem add "${name}" "wfica ${icafile}"
100   ;;   ;;
101    
102   del)   del)
103   if [[ -f ${MCORE_CONFIG_PATH}/citrix/ica/${session}.ica ]]   if [[ -n ${name} ]]
104   then   then
105   rm ${MCORE_CONFIG_PATH}/citrix/ica/"${session}".ica   ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
106   set_fluxbox_menuitem del "${session}"   set_fluxbox_menuitem del "${name}"
107     else
108   elif [[ -z ${file} ]]   for i in $(NOCOLORS=true ${MCORE_LIBDIR}/citrix-session --print)
  then  
  # delete all items, needed to loop through every session  
  # or we delete *all* fluxbox menuitem too  
  for i in ${MCORE_CONFIG_PATH}/citrix/ica/*  
109   do   do
110   rm ${i}   ${MCORE_LIBDIR}/citrix-session --del --name "${i}"
111   set_fluxbox_menuitem del "$(basename ${i} .ica)"   set_fluxbox_menuitem del "${name}"
112   done   done
113   fi   fi
114   ;;   ;;
# Line 161  set_citrix_session() Line 119  set_citrix_session()
119    
120  get_citrix_session()  get_citrix_session()
121  {  {
122   local i   local action="${CLASS_ARGV[0]}"
  local item  
123    
124   for i in $(find ${MCORE_CONFIG_PATH}/citrix/ica -type f)   [[ -z ${action} ]] && help_citrix_serverlist && return 1
  do  
  item="${item} $(basename ${i} .ica)"  
  done  
125    
126   mecho "${item}"   case "${action}" in
127     print) ${MCORE_LIBDIR}/citrix-session --print ;;
128     query) ${MCORE_LIBDIR}/citrix-session --query ;;
129     *) help_citrix_session && return 1 ;;
130     esac
131  }  }
132    
133  set_citrix_serverlist()  set_citrix_serverlist()
134  {  {
135   local action="$1"   local action="${CLASS_ARGV[0]}"
136   local server="$2"   local server="${CLASS_ARGV[1]}"
137   local CONFIG   local i
138    
139   [[ -z ${action} ]] && help_citrix_serverlist && return 1   [[ -z ${action} ]] && help_citrix_serverlist && return 1
140    
141   case "${action}" in   case "${action}" in
142   add)   add) ${MCORE_LIBDIR}/citrix-serverlist --add --server "${server}" ;;
  [[ -z ${server} ]] && help_citrix_serverlist && return 1  
  CONFIG="${MCORE_CONFIG_PATH}/citrix/serverlist/${server}"  
  clearconfig  
  addconfig "${server}"  
  ;;  
   
143   del)   del)
144   if [[ -f ${MCORE_CONFIG_PATH}/citrix/serverlist/${server} ]]   if [[ -n ${server} ]]
  then  
  rm ${MCORE_CONFIG_PATH}/citrix/serverlist/"${server}"  
  elif [[ -z ${server} ]]  
145   then   then
146     ${MCORE_LIBDIR}/citrix-serverlist --del --server "${server}"
147     else
148   # delete all items   # delete all items
149   rm ${MCORE_CONFIG_PATH}/citrix/serverlist/*   for i in $(NOCOLORS=true ${MCORE_LIBDIR}/citrix-serverlist --print)
150     do
151     ${MCORE_LIBDIR}/citrix-serverlist --del --server "${i}"
152     done
153   fi   fi
154   ;;   ;;
155     auto) ${MCORE_LIBDIR}/citrix-serverlist --auto ;;
156   *) help_citrix_serverlist && return 1 ;;   *) help_citrix_serverlist && return 1 ;;
157   esac   esac
158  }  }
159    
160  get_citrix_serverlist()  get_citrix_serverlist()
161  {  {
162   local i   local action="${CLASS_ARGV[0]}"
  local item  
163    
164   for i in $(find ${MCORE_CONFIG_PATH}/citrix/serverlist -type f)   [[ -z ${action} ]] && help_citrix_serverlist && return 1
  do  
  item="${item} $(basename ${i})"  
  done  
165    
166   mecho "${item}"   case "${action}" in
167     print) ${MCORE_LIBDIR}/citrix-serverlist --print ;;
168     query) ${MCORE_LIBDIR}/citrix-serverlist --query ;;
169     *) help_citrix_session && return 1 ;;
170     esac
171  }  }

Legend:
Removed from v.1266  
changed lines
  Added in v.2276