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 |
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] [name] [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." |
175 |
|
|
176 |
get_citrix_session() |
get_citrix_session() |
177 |
{ |
{ |
178 |
list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica |
local action="$1" |
179 |
|
local server="$2" |
180 |
|
local sessionlist |
181 |
|
local sessioncount |
182 |
|
local i |
183 |
|
local exclude |
184 |
|
|
185 |
|
[[ -z ${action} ]] && help_citrix_serverlist && return 1 |
186 |
|
|
187 |
|
case "${action}" in |
188 |
|
print) list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica ;; |
189 |
|
query) |
190 |
|
[[ -n ${PNABROWSE_EXECUTABLE} ]] || eecho "\$PNABROWSE_EXECUTABLE not defined" |
191 |
|
[[ -n ${PNABROWSE_CITRIX_BROWSER} ]] || eecho "\$PNABROWSE_CITRIX_BROWSER not defined" |
192 |
|
if [ -x ${MROOT}/opt/ica-client/util/pnabrowse ] |
193 |
|
then |
194 |
|
if [[ -n ${PNABROWSE_SESSION_EXCLUDE} ]] |
195 |
|
then |
196 |
|
exclude="| grep -v '${PNABROWSE_SESSION_EXCLUDE}'" |
197 |
|
fi |
198 |
|
sessionlist=( $(${MROOT}/${PNABROWSE_EXECUTABLE} -A "${PNABROWSE_CITRIX_BROWSER}" ${exclude}) ) |
199 |
|
sessioncount="${#sessionlist[*]}" |
200 |
|
for (( i=0; i<sessioncount; i++)) |
201 |
|
do |
202 |
|
rvecho -n "${sessionlist[${i}]} " |
203 |
|
done |
204 |
|
rvecho |
205 |
|
else |
206 |
|
eecho "'${MROOT}/${PNABROWSE_EXECUTABLE}' executable not found." |
207 |
|
fi |
208 |
|
;; |
209 |
|
esac |
210 |
} |
} |
211 |
|
|
212 |
set_citrix_serverlist() |
set_citrix_serverlist() |
214 |
local action="$1" |
local action="$1" |
215 |
local server="$2" |
local server="$2" |
216 |
local CONFIG |
local CONFIG |
217 |
|
local serverlist |
218 |
|
local servercount |
219 |
|
local i |
220 |
|
local exclude |
221 |
|
|
222 |
[[ -z ${action} ]] && help_citrix_serverlist && return 1 |
[[ -z ${action} ]] && help_citrix_serverlist && return 1 |
223 |
|
|
230 |
;; |
;; |
231 |
|
|
232 |
del) |
del) |
233 |
if [[ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/${server} ]] |
if [ ! -d ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist ] |
234 |
|
then |
235 |
|
eecho "'${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist' directory not found." |
236 |
|
elif [ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/${server} ] |
237 |
then |
then |
238 |
rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/"${server}" |
rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/"${server}" |
239 |
elif [[ -z ${server} ]] |
elif [[ -z ${server} ]] |
243 |
fi |
fi |
244 |
;; |
;; |
245 |
|
|
246 |
|
auto) |
247 |
|
if [ -x ${MROOT}/opt/ica-client/util/pnabrowse ] |
248 |
|
then |
249 |
|
if [[ -n ${PNABROWSE_SERVER_EXCLUDE} ]] |
250 |
|
then |
251 |
|
exclude="| grep -v '${PNABROWSE_SERVER_EXCLUDE}'" |
252 |
|
fi |
253 |
|
serverlist=( $(${MROOT}/opt/ica-client/util/pnabrowse -S ica ${exclude}) ) |
254 |
|
servercount="${#serverlist[*]}" |
255 |
|
for (( i=0; i<servercount; i++)) |
256 |
|
do |
257 |
|
server="${serverlist[${i}]}" |
258 |
|
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist/${server}" |
259 |
|
clearconfig |
260 |
|
addconfig "${server}" |
261 |
|
done |
262 |
|
else |
263 |
|
eecho "'${MROOT}/opt/ica-client/util/pnabrowse' executable not found." |
264 |
|
fi |
265 |
|
;; |
266 |
|
|
267 |
*) help_citrix_serverlist && return 1 ;; |
*) help_citrix_serverlist && return 1 ;; |
268 |
esac |
esac |
269 |
} |
} |
270 |
|
|
271 |
get_citrix_serverlist() |
get_citrix_serverlist() |
272 |
{ |
{ |
273 |
list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist |
local action="$1" |
274 |
|
local server="$2" |
275 |
|
local serverlist |
276 |
|
local servercount |
277 |
|
local i |
278 |
|
local exclude |
279 |
|
|
280 |
|
[[ -z ${action} ]] && help_citrix_serverlist && return 1 |
281 |
|
|
282 |
|
case "${action}" in |
283 |
|
print) |
284 |
|
list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/serverlist ;; |
285 |
|
query) |
286 |
|
[[ -n ${PNABROWSE_EXECUTABLE} ]] || eecho "\$PNABROWSE_EXECUTABLE not defined" |
287 |
|
[[ -n ${PNABROWSE_CITRIX_BROWSER} ]] || eecho "\$PNABROWSE_CITRIX_BROWSER not defined" |
288 |
|
if [ -x ${MROOT}/${PNABROWSE_EXECUTABLE} ] |
289 |
|
then |
290 |
|
serverlist=( $(${MROOT}/${PNABROWSE_EXECUTABLE} -S ${PNABROWSE_CITRIX_BROWSER}) ) |
291 |
|
servercount="${#serverlist[*]}" |
292 |
|
for (( i=0; i<servercount; i++)) |
293 |
|
do |
294 |
|
rvecho -n "${serverlist[${i}]} " |
295 |
|
done |
296 |
|
rvecho |
297 |
|
else |
298 |
|
eecho "'${MROOT}/${PNABROWSE_EXECUTABLE}' executable not found." |
299 |
|
fi |
300 |
|
;; |
301 |
|
esac |
302 |
} |
} |