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