Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/citrix-session.in
Parent Directory | Revision Log
Revision 2610 -
(hide annotations)
(download)
Tue Sep 22 08:58:47 2015 UTC (8 years, 9 months ago) by niro
File size: 3778 byte(s)
Tue Sep 22 08:58:47 2015 UTC (8 years, 9 months ago) by niro
File size: 3778 byte(s)
-add HttpBrowserAddress to support storefront and newer xenapp servers
1 | niro | 2272 | #!/bin/bash |
2 | |||
3 | MCORE_LIBDIR="@@MCORE_LIBDIR@@" | ||
4 | source @@SYSCONFDIR@@/mcore/mcore.conf | ||
5 | source ${MCORE_LIBDIR}/include/common.global.class | ||
6 | niro | 2343 | source ${MCORE_LIBDIR}/include/daemon.global.class |
7 | niro | 2272 | |
8 | ICADIR="${MCORE_CONFIG_PATH}/citrix/ica" | ||
9 | ICASUFFIX="ica" | ||
10 | |||
11 | die() { echo "ERROR: $@"; exit 1; } | ||
12 | |||
13 | # very basic getops | ||
14 | for argv in $* | ||
15 | do | ||
16 | case $1 in | ||
17 | --add|--del|--print|--query) method="${1//--}" ;; | ||
18 | --name) shift; name="$1" ;; | ||
19 | --session) shift; session="$1" ;; | ||
20 | --mode) shift; mode="$1" ;; | ||
21 | --user) shift; user="$1" ;; | ||
22 | --domain) shift; domain="$1" ;; | ||
23 | --password) shift; password="$1" ;; | ||
24 | esac | ||
25 | shift | ||
26 | done | ||
27 | |||
28 | [[ -n ${method} ]] || die "No method given" | ||
29 | |||
30 | case "${method}" in | ||
31 | add) | ||
32 | # requires name | ||
33 | [[ -n ${name} ]] || die "No name given" | ||
34 | # action 'add' requires mode too | ||
35 | [[ -n ${mode} ]] || die "No mode given" | ||
36 | # and session | ||
37 | [[ -n ${session} ]] || die "No session given" | ||
38 | |||
39 | # other sanity checks | ||
40 | case "${mode}" in | ||
41 | fullscreen) ;; | ||
42 | seamless) ;; | ||
43 | *x*) ;; | ||
44 | *) die "unknown mode '${mode}'" | ||
45 | esac | ||
46 | |||
47 | icafile="${ICADIR}/${name}.${ICASUFFIX}" | ||
48 | CONFIG="${MROOT}/${icafile}" | ||
49 | clearconfig | ||
50 | |||
51 | addconfig '[WFClient]' | ||
52 | addconfig 'Version=2' | ||
53 | |||
54 | niro | 2479 | serverlist=$(NOCOLORS=1 ${MCORE_LIBDIR}/citrix-serverlist --print) |
55 | niro | 2272 | declare -i i=0 |
56 | for server in ${serverlist} | ||
57 | do | ||
58 | (( i++ )) | ||
59 | server_num="${i}" | ||
60 | [[ ${i} -eq 1 ]] && server_num="" | ||
61 | addconfig "TcpBrowserAddress${server_num}=${server}" | ||
62 | niro | 2610 | addconfig "HttpBrowserAddress${server_num}=${server}" |
63 | niro | 2272 | done |
64 | addconfig 'ScreenPercent=0' | ||
65 | addconfig '[ApplicationServers]' | ||
66 | addconfig "${session}=" | ||
67 | addconfig "[${session}]" | ||
68 | addconfig "Address=${session}" | ||
69 | addconfig "InitialProgram=#${session}" | ||
70 | |||
71 | # mapping table xorg -> citrix | ||
72 | # citrix 1 = 16 colors | ||
73 | # citrix 2 = 256 colors | ||
74 | # citrix 4 = 16 bit | ||
75 | # citrix 8 = 32 bit | ||
76 | # try always 16 bit | ||
77 | addconfig "DesiredColor=4" | ||
78 | |||
79 | addconfig 'TransportDriver=TCP/IP' | ||
80 | addconfig 'WinStationDriver=ICA 3.0' | ||
81 | |||
82 | [[ -n ${user} ]] && addconfig "Username=${user}" | ||
83 | [[ -n ${domain} ]] && addconfig "Domain=${domain}" | ||
84 | [[ -n ${password} ]] && addconfig "ClearPassword=${password}" | ||
85 | |||
86 | # use the right display settings | ||
87 | case "${mode}" in | ||
88 | # fullscreen mode | ||
89 | fullscreen) | ||
90 | addconfig 'UseFullScreen=Yes' | ||
91 | addconfig 'NoWindowManager=True' | ||
92 | addconfig "DesiredHRES=65535" | ||
93 | addconfig "DesiredVRES=65535" | ||
94 | ;; | ||
95 | # seamless window mode | ||
96 | seamless) | ||
97 | addconfig 'TWIMode=On' | ||
98 | ;; | ||
99 | # a desired resolution | ||
100 | *x*) | ||
101 | addconfig "DesiredHRES=${mode%x*}" | ||
102 | addconfig "DesiredVRES=${mode#*x}" | ||
103 | ;; | ||
104 | esac | ||
105 | niro | 2319 | |
106 | if is_provided fluxbox | ||
107 | then | ||
108 | # generate fluxbox menu entry | ||
109 | ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "wfica ${icafile}" && | ||
110 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
111 | fi | ||
112 | niro | 2405 | if is_provided idesk |
113 | then | ||
114 | # generate idesk desktop icon | ||
115 | ${MCORE_LIBDIR}/idesk-generate-icon-info --add --name "${name}" --command "wfica ${icafile}" --icon default.png && | ||
116 | ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons | ||
117 | fi | ||
118 | niro | 2272 | ;; |
119 | |||
120 | del) | ||
121 | [[ -n ${name} ]] || die "No name given" | ||
122 | if [ -f ${MROOT}/${ICADIR}/"${name}".${ICASUFFIX} ] | ||
123 | then | ||
124 | rm ${MROOT}/${ICADIR}/"${name}".${ICASUFFIX} | ||
125 | niro | 2319 | if is_provided fluxbox |
126 | then | ||
127 | ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}" && | ||
128 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
129 | fi | ||
130 | niro | 2405 | if is_provided idesk |
131 | then | ||
132 | ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}" && | ||
133 | ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons | ||
134 | fi | ||
135 | niro | 2272 | else |
136 | eecho "No configured session named '${name}' exists." | ||
137 | fi | ||
138 | ;; | ||
139 | |||
140 | print) | ||
141 | list_files_in_directory ${MROOT}/${ICADIR} | ||
142 | ;; | ||
143 | |||
144 | query) | ||
145 | eval sessionlist=( $(${MCORE_LIBDIR}/query-citrix-browser --session) ) | ||
146 | sessioncount="${#sessionlist[*]}" | ||
147 | for (( i=0; i<sessioncount; i++)) | ||
148 | do | ||
149 | rvecho -n "${sessionlist[${i}]};" | ||
150 | done | ||
151 | rvecho | ||
152 | ;; | ||
153 | esac |