Contents of /mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in
Parent Directory | Revision Log
Revision 2728 -
(show annotations)
(download)
Thu Jan 28 14:21:05 2016 UTC (8 years, 7 months ago) by niro
File size: 4782 byte(s)
Thu Jan 28 14:21:05 2016 UTC (8 years, 7 months ago) by niro
File size: 4782 byte(s)
-fixed some typos
1 | # $Id$ |
2 | |
3 | provide citrix ica |
4 | |
5 | # needs fluxbox! |
6 | require fluxbox basic-video |
7 | |
8 | # citrix global config |
9 | include @@SYSCONFDIR@@/mcore/citrix.conf |
10 | |
11 | help_citrix_serverlist() |
12 | { |
13 | mecho "get citrix.serverlist [action]" |
14 | 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 |
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 | mecho " auto - queries given [server] for the serverlist and adds all of them" |
25 | 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 | mecho " print - prints all local configured sessions" |
36 | mecho " query - get sessionlist of the farm from given [server]" |
37 | mecho |
38 | mecho "set citrix.session [action] [name] [session] [mode] [user] [domain] [password] [autostart]" |
39 | mecho " Adds or deletes an ICA session." |
40 | mecho " Available actions:" |
41 | mecho " add - adds a new ica session" |
42 | mecho " del - deletes an ica session named [name]" |
43 | mecho " if no [name] given, all sessions will be deleted" |
44 | 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 | mecho " autostart - session autostart 0=off 1=on- optional" |
57 | } |
58 | |
59 | set_citrix_session() |
60 | { |
61 | local action="${CLASS_ARGV[0]}" |
62 | local name="${CLASS_ARGV[1]}" |
63 | local session="${CLASS_ARGV[2]}" |
64 | local mode="${CLASS_ARGV[3]}" |
65 | local user="${CLASS_ARGV[4]}" |
66 | local domain="${CLASS_ARGV[5]}" |
67 | local password="${CLASS_ARGV[6]}" |
68 | local serverlist="${CLASS_ARGV[7]}" |
69 | local autostart="${CLASS_ARGV[8]}" |
70 | local i |
71 | local opts |
72 | |
73 | [[ -z ${action} ]] && help_citrix_session && return 1 |
74 | |
75 | case "${action}" in |
76 | add) |
77 | # requires name |
78 | [[ -z ${name} ]] && help_citrix_session && return 1 |
79 | # action 'add' need mode too |
80 | [[ -z ${mode} ]] && help_citrix_session && return 1 |
81 | # and session |
82 | [[ -z ${session} ]] && help_citrix_session && return 1 |
83 | |
84 | # other sanity checks |
85 | case "${mode}" in |
86 | fullscreen) ;; |
87 | seamless) ;; |
88 | *x*) ;; |
89 | *) help_citrix_session && return 1 ;; |
90 | esac |
91 | |
92 | if [[ -n ${serverlist} ]] |
93 | then |
94 | opts="--serverlist ${serverlist}" |
95 | fi |
96 | |
97 | # 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 | --password "${password}" \ |
106 | --autostart "${autostart}" \ |
107 | ${opts} |
108 | ;; |
109 | |
110 | del) |
111 | if [[ -n ${name} ]] |
112 | then |
113 | ${MCORE_LIBDIR}/citrix-session --del --name "${name}" |
114 | else |
115 | for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-session --print) |
116 | do |
117 | # basename |
118 | name="${i%.*}" |
119 | ${MCORE_LIBDIR}/citrix-session --del --name "${name}" |
120 | done |
121 | fi |
122 | ;; |
123 | |
124 | *) help_citrix_session && return 1 ;; |
125 | esac |
126 | } |
127 | |
128 | get_citrix_session() |
129 | { |
130 | local action="${CLASS_ARGV[0]}" |
131 | |
132 | [[ -z ${action} ]] && help_citrix_session && 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() |
142 | { |
143 | local action="${CLASS_ARGV[0]}" |
144 | local server="${CLASS_ARGV[1]}" |
145 | local i |
146 | |
147 | [[ -z ${action} ]] && help_citrix_serverlist && return 1 |
148 | |
149 | case "${action}" in |
150 | add) ${MCORE_LIBDIR}/citrix-serverlist --add --server "${server}" ;; |
151 | del) |
152 | if [[ -n ${server} ]] |
153 | then |
154 | ${MCORE_LIBDIR}/citrix-serverlist --del --server "${server}" |
155 | else |
156 | # delete all items |
157 | for i in $(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-serverlist --print) |
158 | do |
159 | ${MCORE_LIBDIR}/citrix-serverlist --del --server "${i}" |
160 | done |
161 | fi |
162 | ;; |
163 | auto) ${MCORE_LIBDIR}/citrix-serverlist --auto ;; |
164 | *) help_citrix_serverlist && return 1 ;; |
165 | esac |
166 | } |
167 | |
168 | get_citrix_serverlist() |
169 | { |
170 | 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 | } |