Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in
Parent Directory | Revision Log
Revision 2634 -
(hide annotations)
(download)
Tue Sep 29 11:43:12 2015 UTC (8 years, 8 months ago) by niro
File size: 4641 byte(s)
Tue Sep 29 11:43:12 2015 UTC (8 years, 8 months ago) by niro
File size: 4641 byte(s)
-allow serverlist override per session
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 | 2038 | mecho "set citrix.session [action] [name] [session] [mode] [user] [domain] [password]" |
39 | niro | 1266 | mecho " Adds or delets a ICA session." |
40 | mecho " Available actions:" | ||
41 | mecho " add - adds a new ica session" | ||
42 | niro | 2272 | mecho " del - deletes ica session with name [name]" |
43 | 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 | } | ||
57 | |||
58 | set_citrix_session() | ||
59 | { | ||
60 | niro | 2269 | local action="${CLASS_ARGV[0]}" |
61 | local name="${CLASS_ARGV[1]}" | ||
62 | local session="${CLASS_ARGV[2]}" | ||
63 | local mode="${CLASS_ARGV[3]}" | ||
64 | niro | 2271 | local user="${CLASS_ARGV[4]}" |
65 | niro | 2269 | local domain="${CLASS_ARGV[5]}" |
66 | local password="${CLASS_ARGV[6]}" | ||
67 | niro | 2634 | local serverlist="${CLASS_ARGV[7]}" |
68 | niro | 1266 | local i |
69 | niro | 2634 | local opts |
70 | niro | 1266 | |
71 | [[ -z ${action} ]] && help_citrix_session && return 1 | ||
72 | |||
73 | case "${action}" in | ||
74 | add) | ||
75 | niro | 2272 | # requires name |
76 | [[ -z ${name} ]] && help_citrix_session && return 1 | ||
77 | niro | 1266 | # action 'add' need mode too |
78 | [[ -z ${mode} ]] && help_citrix_session && return 1 | ||
79 | niro | 2038 | # and session |
80 | [[ -z ${session} ]] && help_citrix_session && return 1 | ||
81 | niro | 1266 | |
82 | # other sanity checks | ||
83 | case "${mode}" in | ||
84 | fullscreen) ;; | ||
85 | seamless) ;; | ||
86 | *x*) ;; | ||
87 | niro | 2274 | *) help_citrix_session && return 1 ;; |
88 | niro | 1266 | esac |
89 | |||
90 | niro | 2634 | if [[ -n ${serverlist} ]] |
91 | then | ||
92 | opts="--serverlist '${serverlist}'" | ||
93 | fi | ||
94 | |||
95 | niro | 2272 | # create citrix session file |
96 | ${MCORE_LIBDIR}/citrix-session \ | ||
97 | --add \ | ||
98 | --name "${name}" \ | ||
99 | --session "${session}" \ | ||
100 | --mode "${mode}" \ | ||
101 | --user "${user}" \ | ||
102 | --domain "${domain}" \ | ||
103 | niro | 2634 | --password "${password}" \ |
104 | ${opts} | ||
105 | niro | 1266 | ;; |
106 | |||
107 | del) | ||
108 | niro | 2273 | if [[ -n ${name} ]] |
109 | niro | 1266 | then |
110 | niro | 2272 | ${MCORE_LIBDIR}/citrix-session --del --name "${name}" |
111 | else | ||
112 | niro | 2479 | for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-session --print) |
113 | niro | 1266 | do |
114 | niro | 2279 | # basename |
115 | name="${i%.*}" | ||
116 | ${MCORE_LIBDIR}/citrix-session --del --name "${name}" | ||
117 | niro | 1266 | done |
118 | niro | 2275 | fi |
119 | niro | 1266 | ;; |
120 | |||
121 | *) help_citrix_session && return 1 ;; | ||
122 | esac | ||
123 | } | ||
124 | |||
125 | get_citrix_session() | ||
126 | { | ||
127 | niro | 2269 | local action="${CLASS_ARGV[0]}" |
128 | niro | 2259 | |
129 | [[ -z ${action} ]] && help_citrix_serverlist && return 1 | ||
130 | |||
131 | case "${action}" in | ||
132 | niro | 2276 | print) ${MCORE_LIBDIR}/citrix-session --print ;; |
133 | query) ${MCORE_LIBDIR}/citrix-session --query ;; | ||
134 | niro | 2261 | *) help_citrix_session && return 1 ;; |
135 | niro | 2259 | esac |
136 | niro | 1266 | } |
137 | |||
138 | set_citrix_serverlist() | ||
139 | { | ||
140 | niro | 2269 | local action="${CLASS_ARGV[0]}" |
141 | local server="${CLASS_ARGV[1]}" | ||
142 | niro | 2259 | local i |
143 | niro | 1266 | |
144 | [[ -z ${action} ]] && help_citrix_serverlist && return 1 | ||
145 | |||
146 | case "${action}" in | ||
147 | niro | 2272 | add) ${MCORE_LIBDIR}/citrix-serverlist --add --server "${server}" ;; |
148 | niro | 1266 | del) |
149 | niro | 2272 | if [[ -n ${server} ]] |
150 | niro | 1266 | then |
151 | niro | 2272 | ${MCORE_LIBDIR}/citrix-serverlist --del --server "${server}" |
152 | else | ||
153 | niro | 1266 | # delete all items |
154 | niro | 2479 | for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-serverlist --print) |
155 | niro | 2259 | do |
156 | niro | 2272 | ${MCORE_LIBDIR}/citrix-serverlist --del --server "${i}" |
157 | niro | 2259 | done |
158 | fi | ||
159 | ;; | ||
160 | niro | 2272 | auto) ${MCORE_LIBDIR}/citrix-serverlist --auto ;; |
161 | niro | 1266 | *) help_citrix_serverlist && return 1 ;; |
162 | esac | ||
163 | } | ||
164 | |||
165 | get_citrix_serverlist() | ||
166 | { | ||
167 | niro | 2269 | local action="${CLASS_ARGV[0]}" |
168 | niro | 2259 | |
169 | [[ -z ${action} ]] && help_citrix_serverlist && return 1 | ||
170 | |||
171 | case "${action}" in | ||
172 | niro | 2276 | print) ${MCORE_LIBDIR}/citrix-serverlist --print ;; |
173 | query) ${MCORE_LIBDIR}/citrix-serverlist --query ;; | ||
174 | niro | 2261 | *) help_citrix_session && return 1 ;; |
175 | niro | 2259 | esac |
176 | niro | 1266 | } |