Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/citrix-session.in
Parent Directory | Revision Log
Revision 2343 -
(hide annotations)
(download)
Mon Jul 14 11:55:14 2014 UTC (9 years, 10 months ago) by niro
File size: 3322 byte(s)
Mon Jul 14 11:55:14 2014 UTC (9 years, 10 months ago) by niro
File size: 3322 byte(s)
-added missing include
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 | 2278 | serverlist=$(NOCOLORS=true ${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 | done | ||
63 | addconfig 'ScreenPercent=0' | ||
64 | addconfig '[ApplicationServers]' | ||
65 | addconfig "${session}=" | ||
66 | addconfig "[${session}]" | ||
67 | addconfig "Address=${session}" | ||
68 | addconfig "InitialProgram=#${session}" | ||
69 | |||
70 | # mapping table xorg -> citrix | ||
71 | # citrix 1 = 16 colors | ||
72 | # citrix 2 = 256 colors | ||
73 | # citrix 4 = 16 bit | ||
74 | # citrix 8 = 32 bit | ||
75 | # try always 16 bit | ||
76 | addconfig "DesiredColor=4" | ||
77 | |||
78 | addconfig 'TransportDriver=TCP/IP' | ||
79 | addconfig 'WinStationDriver=ICA 3.0' | ||
80 | |||
81 | [[ -n ${user} ]] && addconfig "Username=${user}" | ||
82 | [[ -n ${domain} ]] && addconfig "Domain=${domain}" | ||
83 | [[ -n ${password} ]] && addconfig "ClearPassword=${password}" | ||
84 | |||
85 | # use the right display settings | ||
86 | case "${mode}" in | ||
87 | # fullscreen mode | ||
88 | fullscreen) | ||
89 | addconfig 'UseFullScreen=Yes' | ||
90 | addconfig 'NoWindowManager=True' | ||
91 | addconfig "DesiredHRES=65535" | ||
92 | addconfig "DesiredVRES=65535" | ||
93 | ;; | ||
94 | # seamless window mode | ||
95 | seamless) | ||
96 | addconfig 'TWIMode=On' | ||
97 | ;; | ||
98 | # a desired resolution | ||
99 | *x*) | ||
100 | addconfig "DesiredHRES=${mode%x*}" | ||
101 | addconfig "DesiredVRES=${mode#*x}" | ||
102 | ;; | ||
103 | esac | ||
104 | niro | 2319 | |
105 | if is_provided fluxbox | ||
106 | then | ||
107 | # generate fluxbox menu entry | ||
108 | ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "wfica ${icafile}" && | ||
109 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
110 | fi | ||
111 | niro | 2272 | ;; |
112 | |||
113 | del) | ||
114 | [[ -n ${name} ]] || die "No name given" | ||
115 | if [ -f ${MROOT}/${ICADIR}/"${name}".${ICASUFFIX} ] | ||
116 | then | ||
117 | rm ${MROOT}/${ICADIR}/"${name}".${ICASUFFIX} | ||
118 | niro | 2319 | if is_provided fluxbox |
119 | then | ||
120 | ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}" && | ||
121 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
122 | fi | ||
123 | niro | 2272 | else |
124 | eecho "No configured session named '${name}' exists." | ||
125 | fi | ||
126 | ;; | ||
127 | |||
128 | print) | ||
129 | list_files_in_directory ${MROOT}/${ICADIR} | ||
130 | ;; | ||
131 | |||
132 | query) | ||
133 | eval sessionlist=( $(${MCORE_LIBDIR}/query-citrix-browser --session) ) | ||
134 | sessioncount="${#sessionlist[*]}" | ||
135 | for (( i=0; i<sessioncount; i++)) | ||
136 | do | ||
137 | rvecho -n "${sessionlist[${i}]};" | ||
138 | done | ||
139 | rvecho | ||
140 | ;; | ||
141 | esac |