Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2728 - (hide annotations) (download)
Thu Jan 28 14:21:05 2016 UTC (8 years, 3 months ago) by niro
File size: 4782 byte(s)
-fixed some typos
1 niro 1266 # $Id$
2    
3     provide citrix ica
4    
5     # needs fluxbox!
6     require fluxbox basic-video
7    
8 niro 2259 # citrix global config
9     include @@SYSCONFDIR@@/mcore/citrix.conf
10    
11 niro 1266 help_citrix_serverlist()
12     {
13 niro 2259 mecho "get citrix.serverlist [action]"
14 niro 1266 mecho " Shows all hosts added on the serverlist."
15 niro 2259 mecho " [actions]:"
16     mecho " print - prints local configured serverlist"
17     mecho " query - get serverlist of the farm from given [server]"
18 niro 1266 mecho
19     mecho "set citrix.serverlist [action] [host]"
20     mecho " Adds or deletes a server from the ica serverlist."
21     mecho " [actions]:"
22     mecho " add - adds a server"
23     mecho " del - deletes a server"
24 niro 2259 mecho " auto - queries given [server] for the serverlist and adds all of them"
25 niro 1266 mecho
26     mecho " host - dns hostname or ip of the server"
27     mecho
28     mecho " If no [host] was given, all entries are deleted."
29     }
30    
31     help_citrix_session()
32     {
33     mecho "get citrix.session"
34     mecho " Shows all configured ICA sessions"
35 niro 2259 mecho " print - prints all local configured sessions"
36     mecho " query - get sessionlist of the farm from given [server]"
37 niro 1266 mecho
38 niro 2728 mecho "set citrix.session [action] [name] [session] [mode] [user] [domain] [password] [autostart]"
39     mecho " Adds or deletes an ICA session."
40 niro 1266 mecho " Available actions:"
41     mecho " add - adds a new ica session"
42 niro 2728 mecho " del - deletes an ica session named [name]"
43 niro 2272 mecho " if no [name] given, all sessions will be deleted"
44 niro 1266 mecho
45     mecho " Available modes:"
46     mecho " fullscreen - fullscreen session"
47     mecho " seamless - seamless windows session"
48     mecho " *x* - windowed session with given resolution"
49     mecho " any resonable resolution is fine like:"
50     mecho " 1024x768, 1280x1024, 1440x900 etc"
51     mecho
52     mecho " session - name of the Citrix session"
53     mecho " user - user inside the session - optional"
54     mecho " domain - logon domain of the user - optional"
55     mecho " password - password of the user - optional"
56 niro 2642 mecho " autostart - session autostart 0=off 1=on- optional"
57 niro 1266 }
58    
59     set_citrix_session()
60     {
61 niro 2269 local action="${CLASS_ARGV[0]}"
62     local name="${CLASS_ARGV[1]}"
63     local session="${CLASS_ARGV[2]}"
64     local mode="${CLASS_ARGV[3]}"
65 niro 2271 local user="${CLASS_ARGV[4]}"
66 niro 2269 local domain="${CLASS_ARGV[5]}"
67     local password="${CLASS_ARGV[6]}"
68 niro 2634 local serverlist="${CLASS_ARGV[7]}"
69 niro 2642 local autostart="${CLASS_ARGV[8]}"
70 niro 1266 local i
71 niro 2634 local opts
72 niro 1266
73     [[ -z ${action} ]] && help_citrix_session && return 1
74    
75     case "${action}" in
76     add)
77 niro 2272 # requires name
78     [[ -z ${name} ]] && help_citrix_session && return 1
79 niro 1266 # action 'add' need mode too
80     [[ -z ${mode} ]] && help_citrix_session && return 1
81 niro 2038 # and session
82     [[ -z ${session} ]] && help_citrix_session && return 1
83 niro 1266
84     # other sanity checks
85     case "${mode}" in
86     fullscreen) ;;
87     seamless) ;;
88     *x*) ;;
89 niro 2274 *) help_citrix_session && return 1 ;;
90 niro 1266 esac
91    
92 niro 2634 if [[ -n ${serverlist} ]]
93     then
94 niro 2635 opts="--serverlist ${serverlist}"
95 niro 2634 fi
96    
97 niro 2272 # create citrix session file
98     ${MCORE_LIBDIR}/citrix-session \
99     --add \
100     --name "${name}" \
101     --session "${session}" \
102     --mode "${mode}" \
103     --user "${user}" \
104     --domain "${domain}" \
105 niro 2634 --password "${password}" \
106 niro 2642 --autostart "${autostart}" \
107 niro 2634 ${opts}
108 niro 1266 ;;
109    
110     del)
111 niro 2273 if [[ -n ${name} ]]
112 niro 1266 then
113 niro 2272 ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
114     else
115 niro 2479 for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-session --print)
116 niro 1266 do
117 niro 2279 # basename
118     name="${i%.*}"
119     ${MCORE_LIBDIR}/citrix-session --del --name "${name}"
120 niro 1266 done
121 niro 2275 fi
122 niro 1266 ;;
123    
124     *) help_citrix_session && return 1 ;;
125     esac
126     }
127    
128     get_citrix_session()
129     {
130 niro 2269 local action="${CLASS_ARGV[0]}"
131 niro 2259
132 niro 2728 [[ -z ${action} ]] && help_citrix_session && return 1
133 niro 2259
134     case "${action}" in
135 niro 2276 print) ${MCORE_LIBDIR}/citrix-session --print ;;
136     query) ${MCORE_LIBDIR}/citrix-session --query ;;
137 niro 2261 *) help_citrix_session && return 1 ;;
138 niro 2259 esac
139 niro 1266 }
140    
141     set_citrix_serverlist()
142     {
143 niro 2269 local action="${CLASS_ARGV[0]}"
144     local server="${CLASS_ARGV[1]}"
145 niro 2259 local i
146 niro 1266
147     [[ -z ${action} ]] && help_citrix_serverlist && return 1
148    
149     case "${action}" in
150 niro 2272 add) ${MCORE_LIBDIR}/citrix-serverlist --add --server "${server}" ;;
151 niro 1266 del)
152 niro 2272 if [[ -n ${server} ]]
153 niro 1266 then
154 niro 2272 ${MCORE_LIBDIR}/citrix-serverlist --del --server "${server}"
155     else
156 niro 1266 # delete all items
157 niro 2479 for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-serverlist --print)
158 niro 2259 do
159 niro 2272 ${MCORE_LIBDIR}/citrix-serverlist --del --server "${i}"
160 niro 2259 done
161     fi
162     ;;
163 niro 2272 auto) ${MCORE_LIBDIR}/citrix-serverlist --auto ;;
164 niro 1266 *) help_citrix_serverlist && return 1 ;;
165     esac
166     }
167    
168     get_citrix_serverlist()
169     {
170 niro 2269 local action="${CLASS_ARGV[0]}"
171 niro 2259
172     [[ -z ${action} ]] && help_citrix_serverlist && return 1
173    
174     case "${action}" in
175 niro 2276 print) ${MCORE_LIBDIR}/citrix-serverlist --print ;;
176     query) ${MCORE_LIBDIR}/citrix-serverlist --query ;;
177 niro 2261 *) help_citrix_session && return 1 ;;
178 niro 2259 esac
179 niro 1266 }