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 2642 by niro, Thu Oct 8 10:23:56 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 44  help_citrix_session() Line 53  help_citrix_session()
53   mecho "   user       - user inside the session - optional"   mecho "   user       - user inside the session - optional"
54   mecho "   domain     - logon domain of the user - optional"   mecho "   domain     - logon domain of the user - optional"
55   mecho "   password   - password of the user - optional"   mecho "   password   - password of the user - optional"
56     mecho "   autostart  - session autostart 0=off 1=on- optional"
57  }  }
58    
59  set_citrix_session()  set_citrix_session()
60  {  {
61   local action="$1"   local action="${CLASS_ARGV[0]}"
62   local session="$2"   local name="${CLASS_ARGV[1]}"
63   local mode="$3"   local session="${CLASS_ARGV[2]}"
64   local user="$4"   local mode="${CLASS_ARGV[3]}"
65   local domain="$5"   local user="${CLASS_ARGV[4]}"
66   local password="$6"   local domain="${CLASS_ARGV[5]}"
67   local serverlist   local password="${CLASS_ARGV[6]}"
68   local server   local serverlist="${CLASS_ARGV[7]}"
69   local server_num   local autostart="${CLASS_ARGV[8]}"
  local icafile  
  local CONFIG  
70   local i   local i
71     local opts
72    
73   [[ -z ${action} ]] && help_citrix_session && return 1   [[ -z ${action} ]] && help_citrix_session && return 1
  [[ -z ${session} ]] && help_citrix_session && return 1  
74    
75   case "${action}" in   case "${action}" in
76   add)   add)
77     # requires name
78     [[ -z ${name} ]] && help_citrix_session && return 1
79   # action 'add' need mode too   # action 'add' need mode too
80   [[ -z ${mode} ]] && help_citrix_session && return 1   [[ -z ${mode} ]] && help_citrix_session && return 1
81     # and session
82     [[ -z ${session} ]] && help_citrix_session && return 1
83    
84   # other sanity checks   # other sanity checks
85   case "${mode}" in   case "${mode}" in
86   fullscreen) ;;   fullscreen) ;;
87   seamless) ;;   seamless) ;;
88   *x*) ;;   *x*) ;;
89   *) help_citrix_session && return 1   *) help_citrix_session && return 1 ;;
90   esac   esac
91    
92   icafile="${MCORE_CONFIG_PATH}/citrix/ica/${session}.ica"   if [[ -n ${serverlist} ]]
93   CONFIG="${MROOT}/${icafile}"   then
94   clearconfig   opts="--serverlist ${serverlist}"
95     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  
96    
97   # generate fluxbox menu entry   # create citrix session file
98   set_fluxbox_menuitem add "${session}" "wfica ${icafile}"   ${MCORE_LIBDIR}/citrix-session \
99     --add \
100     --name "${name}" \
101     --session "${session}" \
102     --mode "${mode}" \
103     --user "${user}" \
104     --domain "${domain}" \
105     --password "${password}" \
106     --autostart "${autostart}" \
107     ${opts}
108   ;;   ;;
109    
110   del)   del)
111   if [ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica/"${session}".ica ]   if [[ -n ${name} ]]
112   then   then
113   rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica/"${session}".ica   ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
114   set_fluxbox_menuitem del "${session}"   else
115     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)  
116   do   do
117   rm ${i}   # basename
118   set_fluxbox_menuitem del "$(basename ${i} .ica)"   name="${i%.*}"
119     ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
120   done   done
121   fi   fi
122   ;;   ;;
# Line 163  set_citrix_session() Line 127  set_citrix_session()
127    
128  get_citrix_session()  get_citrix_session()
129  {  {
130   list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica   local action="${CLASS_ARGV[0]}"
131    
132     [[ -z ${action} ]] && help_citrix_serverlist && return 1
133    
134     case "${action}" in
135     print) ${MCORE_LIBDIR}/citrix-session --print ;;
136     query) ${MCORE_LIBDIR}/citrix-session --query ;;
137     *) help_citrix_session && return 1 ;;
138     esac
139  }  }
140    
141  set_citrix_serverlist()  set_citrix_serverlist()
142  {  {
143   local action="$1"   local action="${CLASS_ARGV[0]}"
144   local server="$2"   local server="${CLASS_ARGV[1]}"
145   local CONFIG   local i
146    
147   [[ -z ${action} ]] && help_citrix_serverlist && return 1   [[ -z ${action} ]] && help_citrix_serverlist && return 1
148    
149   case "${action}" in   case "${action}" in
150   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}"  
  ;;  
   
151   del)   del)
152   if [[ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/${server} ]]   if [[ -n ${server} ]]
  then  
  rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/"${server}"  
  elif [[ -z ${server} ]]  
153   then   then
154     ${MCORE_LIBDIR}/citrix-serverlist --del --server "${server}"
155     else
156   # delete all items   # delete all items
157   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)
158     do
159     ${MCORE_LIBDIR}/citrix-serverlist --del --server "${i}"
160     done
161   fi   fi
162   ;;   ;;
163     auto) ${MCORE_LIBDIR}/citrix-serverlist --auto ;;
164   *) help_citrix_serverlist && return 1 ;;   *) help_citrix_serverlist && return 1 ;;
165   esac   esac
166  }  }
167    
168  get_citrix_serverlist()  get_citrix_serverlist()
169  {  {
170   list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist   local action="${CLASS_ARGV[0]}"
171    
172     [[ -z ${action} ]] && help_citrix_serverlist && return 1
173    
174     case "${action}" in
175     print) ${MCORE_LIBDIR}/citrix-serverlist --print ;;
176     query) ${MCORE_LIBDIR}/citrix-serverlist --query ;;
177     *) help_citrix_session && return 1 ;;
178     esac
179  }  }

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