Annotation of /alx-src/branches/alxconf-060/functions/config_sessions.sh
Parent Directory | Revision Log
Revision 5618 -
(hide annotations)
(download)
(as text)
Thu Apr 24 07:42:50 2014 UTC (10 years ago) by niro
File MIME type: application/x-sh
File size: 16498 byte(s)
Thu Apr 24 07:42:50 2014 UTC (10 years ago) by niro
File MIME type: application/x-sh
File size: 16498 byte(s)
-add HttpBroweserAddresses also
1 | niro | 2001 | # $Id$ |
2 | niro | 236 | # configures ica-sessions on the host via mysql db settings |
3 | |||
4 | niro | 2161 | fix_whitespaces() |
5 | { | ||
6 | local var="$@" | ||
7 | echo "${var//\ /_}" | ||
8 | } | ||
9 | |||
10 | niro | 2149 | # helper function to create citrix session files |
11 | generate_ica_session_file() | ||
12 | niro | 236 | { |
13 | niro | 246 | local i |
14 | niro | 2149 | local num |
15 | niro | 246 | local server |
16 | local ses_session | ||
17 | local ses_filename | ||
18 | local ses_username | ||
19 | local ses_domain | ||
20 | local ses_password | ||
21 | local ses_browseradrs | ||
22 | niro | 2435 | local ses_colors |
23 | niro | 2035 | local CONFIG |
24 | niro | 246 | |
25 | niro | 2149 | # very basic getops |
26 | for i in $* | ||
27 | niro | 246 | do |
28 | niro | 2149 | case $1 in |
29 | --session) shift; ses_session="$1" ;; | ||
30 | --filename) shift; ses_filename="$1" ;; | ||
31 | --username) shift; ses_username="$1" ;; | ||
32 | --password) shift; ses_password="$1" ;; | ||
33 | --domain) shift; ses_domain="$1" ;; | ||
34 | niro | 2161 | --server) shift; ses_browseradrs="$1" ;; |
35 | niro | 2435 | --colordepth) shift; ses_colors="$1" ;; |
36 | niro | 2149 | esac |
37 | shift | ||
38 | done | ||
39 | niro | 246 | |
40 | niro | 2149 | # abort if session, filename or server not given |
41 | niro | 2161 | [[ -z ${ses_session} ]] && return 1 |
42 | [[ -z ${ses_filename} ]] && return 1 | ||
43 | [[ -z ${ses_browseradrs} ]] && return 1 | ||
44 | niro | 272 | |
45 | niro | 2149 | # write session files |
46 | CONFIG="${ALX_ICA_SESSIONS}/${ses_filename}" | ||
47 | clearconfig | ||
48 | niro | 2035 | |
49 | niro | 2149 | addconfig '[WFClient]' |
50 | addconfig 'Version=2' | ||
51 | niro | 1654 | |
52 | niro | 2149 | # use ';' as ifs |
53 | declare -i i=0 | ||
54 | for server in ${ses_browseradrs//;/ } | ||
55 | do | ||
56 | (( i++ )) | ||
57 | num="${i}" | ||
58 | # support newer ica-clients: | ||
59 | # the first address must be named TcpBrowserAddress, but not TcpBrowserAddress1 !! | ||
60 | [[ ${i} -eq 1 ]] && num="" | ||
61 | addconfig "TcpBrowserAddress${num}=${server}" | ||
62 | niro | 5618 | addconfig "HttpBrowserAddress${num}=${server}" |
63 | niro | 246 | done |
64 | niro | 2149 | |
65 | addconfig 'ScreenPercent=0' | ||
66 | addconfig '[ApplicationServers]' | ||
67 | addconfig "${ses_session}=" | ||
68 | addconfig "[${ses_session}]" | ||
69 | addconfig "Address=${ses_session}" | ||
70 | addconfig "InitialProgram=#${ses_session}" | ||
71 | niro | 2435 | |
72 | # convert to ica session file values | ||
73 | case ${ses_colors} in | ||
74 | 24|32) ses_colors="8";; | ||
75 | 16) ses_colors="4";; | ||
76 | 8) ses_colors="2";; | ||
77 | *) ses_colors="4";; # default to 16bit | ||
78 | esac | ||
79 | addconfig "DesiredColor=${ses_colors}" | ||
80 | niro | 2149 | addconfig 'TransportDriver=TCP/IP' |
81 | addconfig 'WinStationDriver=ICA 3.0' | ||
82 | niro | 2611 | addconfig "ClearPassword=${ses_password}" |
83 | niro | 2149 | addconfig "Username=${ses_username}" |
84 | addconfig "Domain=${ses_domain}" | ||
85 | addconfig 'UseFullScreen=Yes' | ||
86 | addconfig 'NoWindowManager=True' | ||
87 | niro | 246 | } |
88 | |||
89 | niro | 317 | # generates a sh file to start programs |
90 | generate_program_sh() | ||
91 | { | ||
92 | local dest | ||
93 | local name | ||
94 | local exec | ||
95 | niro | 2161 | local param |
96 | niro | 317 | local workdir |
97 | niro | 2035 | local CONFIG |
98 | niro | 317 | |
99 | # very basic getops | ||
100 | for i in $* | ||
101 | do | ||
102 | case $1 in | ||
103 | --name|-n) shift; name="$1" ;; | ||
104 | --exec|-x) shift; exec="$1" ;; | ||
105 | niro | 2161 | --param|-p) shift; param="$1" ;; |
106 | niro | 317 | --dest|-d) shift; dest="$1" ;; |
107 | --workdir|-w) shift; workdir="$1" ;; | ||
108 | esac | ||
109 | shift | ||
110 | done | ||
111 | |||
112 | # abort if name, dest or exec not given | ||
113 | niro | 2149 | [[ -z ${name} ]] && return 1 |
114 | [[ -z ${exec} ]] && return 1 | ||
115 | [[ -z ${dest} ]] && return 1 | ||
116 | niro | 317 | |
117 | niro | 2149 | CONFIG="${dest}" |
118 | niro | 2035 | addconfig "#!/bin/sh" |
119 | [ -n "${workdir}" ] && addconfig "cd ${workdir}" | ||
120 | niro | 2161 | addconfig "exec ${exec} ${param}" |
121 | niro | 317 | |
122 | niro | 2149 | chmod 0755 "${dest}" |
123 | niro | 317 | } |
124 | |||
125 | niro | 304 | # helper functions for generate all desktop icons |
126 | generate_icon() | ||
127 | { | ||
128 | local name | ||
129 | local icon | ||
130 | local command | ||
131 | local dest | ||
132 | local yres | ||
133 | local xres | ||
134 | local iwidth | ||
135 | local iheight | ||
136 | niro | 317 | local deficon |
137 | niro | 2035 | local CONFIG |
138 | niro | 2401 | local utility |
139 | niro | 304 | |
140 | # very basic getops | ||
141 | for i in $* | ||
142 | do | ||
143 | case $1 in | ||
144 | --name|-n) shift; name="$1" ;; | ||
145 | --command|-c) shift; command="$1" ;; | ||
146 | --icon|-i) shift; icon="$1" ;; | ||
147 | --dest|-d) shift; dest="$1" ;; | ||
148 | --xres|-x) shift; xres="$1" ;; | ||
149 | --yres|-y) shift; yres="$1" ;; | ||
150 | --icon-width|-w) shift; iwidth="$1" ;; | ||
151 | --icon-height|-h) shift; iheight="$1" ;; | ||
152 | niro | 317 | --default-icon) shift; deficon="$1" ;; |
153 | niro | 304 | esac |
154 | shift | ||
155 | done | ||
156 | |||
157 | niro | 2149 | # some sanity checks: |
158 | niro | 2401 | |
159 | niro | 304 | # abort if name or command not given |
160 | niro | 2035 | [[ -z ${name} ]] && return 1 |
161 | [[ -z ${command} ]] && return 1 | ||
162 | niro | 304 | |
163 | niro | 2454 | [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk" |
164 | niro | 2401 | |
165 | niro | 304 | # use some defaults for icon, dest, {x,y}res |
166 | niro | 2495 | [[ -z ${xres} ]] && xres=50 |
167 | [[ -z ${yres} ]] && xres=50 | ||
168 | niro | 2035 | if [[ -z ${icon} ]] || [ ! -f ${icon} ] |
169 | niro | 304 | then |
170 | niro | 317 | # if no default icon is given use default.png |
171 | niro | 2035 | [[ -z ${deficon} ]] && deficon="default.png" |
172 | niro | 317 | icon="${ALX_SESSIONS_ICONS}/${deficon}" |
173 | niro | 304 | fi |
174 | |||
175 | niro | 2161 | CONFIG="${dest}" |
176 | niro | 2035 | clearconfig |
177 | niro | 304 | |
178 | niro | 2035 | addconfig 'table Icon' |
179 | addconfig " Caption: ${name}" | ||
180 | addconfig " Command: ${command}" | ||
181 | addconfig " Icon: ${icon}" | ||
182 | addconfig " X: ${xres}" | ||
183 | addconfig " Y: ${yres}" | ||
184 | |||
185 | niro | 304 | # add these only if not zero |
186 | niro | 2035 | if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]] |
187 | niro | 304 | then |
188 | niro | 2454 | addconfig " Width: ${iwidth}" |
189 | addconfig " Height: ${iheight}" | ||
190 | niro | 304 | fi |
191 | |||
192 | niro | 2035 | addconfig 'end' |
193 | niro | 304 | } |
194 | |||
195 | generate_all_desktop_icons() | ||
196 | { | ||
197 | niro | 2149 | local session_list="$1" |
198 | local other_menuitem_list="$2" | ||
199 | niro | 2747 | local plugin_list="$3" |
200 | niro | 304 | local res |
201 | local xres | ||
202 | local yres | ||
203 | local x | ||
204 | local y | ||
205 | niro | 2161 | local i |
206 | niro | 2149 | local name |
207 | niro | 317 | local progsh_path |
208 | niro | 2401 | local utility |
209 | local dest | ||
210 | local rc | ||
211 | niro | 304 | |
212 | niro | 2454 | dest="${ALX_UNPRIV_HOME}/.idesktop" |
213 | rc="${ALX_UNPRIV_HOME}/.ideskrc" | ||
214 | niro | 2401 | |
215 | niro | 2149 | # progsh path |
216 | niro | 2161 | progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
217 | niro | 2149 | |
218 | niro | 304 | # get the resolution |
219 | niro | 342 | res=$(mysqldo "select resolution from cfg_graphic where serial='${ALX_SERIAL}'") |
220 | niro | 304 | |
221 | # split res to x & y | ||
222 | niro | 2149 | xres="${res%x*}" |
223 | niro | 2166 | yres="${res#*x}" |
224 | niro | 304 | |
225 | # top left edge of the icon is given in config file | ||
226 | # remove a little bit to simulate the bottom-right edge | ||
227 | xres="$(( ${xres} - 120 ))" | ||
228 | yres="$(( ${yres} - 80 ))" | ||
229 | |||
230 | # clean desktop icon location | ||
231 | niro | 2401 | [ -d ${dest} ] && rm -rf ${dest} |
232 | [ -f ${rc} ] && rm -f ${rc} | ||
233 | install -d ${dest} | ||
234 | niro | 304 | |
235 | # default settings | ||
236 | niro | 2495 | declare -i x=50 |
237 | declare -i y=50 | ||
238 | niro | 304 | |
239 | niro | 2149 | # ica icons |
240 | niro | 2161 | for i in ${session_list} |
241 | niro | 304 | do |
242 | # abort if empty | ||
243 | niro | 2161 | [[ -z ${i} ]] && continue |
244 | niro | 304 | |
245 | niro | 2161 | # get database information |
246 | evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'" | ||
247 | |||
248 | niro | 304 | # new line if x > xres |
249 | niro | 2035 | if [ ${x} -ge ${xres} ] |
250 | then | ||
251 | niro | 2495 | x=50 |
252 | niro | 304 | y=$((${y} + 80)) |
253 | fi | ||
254 | |||
255 | # new row if y > yres | ||
256 | niro | 2035 | if [ ${y} -ge ${yres} ] |
257 | then | ||
258 | niro | 304 | x=$((${x} + 120)) |
259 | niro | 2495 | y=50 |
260 | niro | 304 | |
261 | # re-check x | ||
262 | niro | 2495 | [ ${x} -ge ${xres} ] && x=50 |
263 | niro | 304 | fi |
264 | |||
265 | generate_icon \ | ||
266 | niro | 2166 | --name "${cfg_sessions_session}" \ |
267 | niro | 5013 | --command "wfica-launcher ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})" \ |
268 | niro | 2166 | --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_sessions_session}).png" \ |
269 | niro | 2401 | --dest "${dest}/$(fix_whitespaces ${cfg_sessions_session}).lnk" \ |
270 | niro | 304 | --xres "${x}" \ |
271 | --yres "${y}" | ||
272 | |||
273 | y=$((${y} + 80)) | ||
274 | done | ||
275 | |||
276 | niro | 2161 | for i in ${other_menuitem_list} |
277 | niro | 317 | do |
278 | # abort if empty | ||
279 | niro | 2161 | [[ -z ${i} ]] && continue |
280 | niro | 317 | |
281 | niro | 2161 | # get database information |
282 | evaluate_table cfg_other_menuitems "where serial='${ALX_SERIAL}' and id='${i}'" | ||
283 | |||
284 | niro | 317 | # new line if x > xres |
285 | niro | 2035 | if [ ${x} -ge ${xres} ] |
286 | then | ||
287 | niro | 2495 | x=50 |
288 | niro | 317 | y=$((${y} + 80)) |
289 | fi | ||
290 | |||
291 | # new row if y > yres | ||
292 | niro | 2035 | if [ ${y} -ge ${yres} ] |
293 | then | ||
294 | niro | 317 | x=$((${x} + 120)) |
295 | niro | 2495 | y=50 |
296 | niro | 317 | |
297 | # re-check x | ||
298 | niro | 2495 | [ ${x} -ge ${xres} ] && x=50 |
299 | niro | 317 | fi |
300 | |||
301 | generate_icon \ | ||
302 | niro | 2161 | --name "${cfg_other_menuitems_name}" \ |
303 | niro | 2381 | --command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ |
304 | niro | 2161 | --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_name}).png" \ |
305 | niro | 2401 | --dest "${dest}/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \ |
306 | niro | 317 | --xres "${x}" \ |
307 | --yres "${y}" \ | ||
308 | --default-icon "default_item.png" | ||
309 | |||
310 | y=$((${y} + 80)) | ||
311 | done | ||
312 | niro | 2747 | |
313 | for i in ${plugin_list} | ||
314 | do | ||
315 | # abort if empty | ||
316 | [[ -z ${i} ]] && continue | ||
317 | niro | 3490 | |
318 | niro | 2747 | evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'" |
319 | if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]] | ||
320 | then | ||
321 | eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem) | ||
322 | niro | 317 | |
323 | niro | 2747 | # abort if name or exec is empty |
324 | [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue | ||
325 | [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue | ||
326 | |||
327 | # new line if x > xres | ||
328 | if [ ${x} -ge ${xres} ] | ||
329 | then | ||
330 | x=50 | ||
331 | y=$((${y} + 80)) | ||
332 | fi | ||
333 | |||
334 | # new row if y > yres | ||
335 | if [ ${y} -ge ${yres} ] | ||
336 | then | ||
337 | x=$((${x} + 120)) | ||
338 | y=50 | ||
339 | |||
340 | # re-check x | ||
341 | [ ${x} -ge ${xres} ] && x=50 | ||
342 | fi | ||
343 | |||
344 | generate_icon \ | ||
345 | --name "${PLUGIN_MENUITEM_NAME}" \ | ||
346 | --command "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \ | ||
347 | --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).png" \ | ||
348 | --dest "${dest}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).lnk" \ | ||
349 | --xres "${x}" \ | ||
350 | --yres "${y}" \ | ||
351 | --default-icon "default_item.png" | ||
352 | |||
353 | y=$((${y} + 80)) | ||
354 | fi | ||
355 | |||
356 | # unset all variables | ||
357 | unset PLUGIN_MENUITEM_NAME | ||
358 | unset PLUGIN_MENUITEM_EXEC | ||
359 | unset PLUGIN_MENUITEM_PARAM | ||
360 | unset PLUGIN_MENUITEM_WORKDIR | ||
361 | unset PLUGIN_MENUITEM_ICON | ||
362 | done | ||
363 | |||
364 | niro | 2469 | # add shutdown, reboot icons |
365 | for i in shutdown reboot | ||
366 | do | ||
367 | # new line if x > xres | ||
368 | if [ ${x} -ge ${xres} ] | ||
369 | then | ||
370 | niro | 2495 | x=50 |
371 | niro | 2469 | y=$((${y} + 80)) |
372 | fi | ||
373 | |||
374 | # new row if y > yres | ||
375 | if [ ${y} -ge ${yres} ] | ||
376 | then | ||
377 | x=$((${x} + 120)) | ||
378 | niro | 2495 | y=50 |
379 | niro | 2469 | |
380 | # re-check x | ||
381 | niro | 2495 | [ ${x} -ge ${xres} ] && x=50 |
382 | niro | 2469 | fi |
383 | |||
384 | case ${i} in | ||
385 | niro | 2479 | shutdown) name="Herunterfahren" ;; |
386 | reboot) name="Neustarten" ;; | ||
387 | niro | 2469 | esac |
388 | |||
389 | generate_icon \ | ||
390 | --name "${name}" \ | ||
391 | --command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \ | ||
392 | --icon "${ALX_SESSIONS_ICONS}/${i}.png" \ | ||
393 | --dest "${dest}/${i}.lnk" \ | ||
394 | --xres "${x}" \ | ||
395 | niro | 2565 | --yres "${y}" \ |
396 | --icon-width "40" \ | ||
397 | --icon-height "40" | ||
398 | niro | 2469 | |
399 | y=$((${y} + 80)) | ||
400 | done | ||
401 | |||
402 | niro | 304 | # last but not least gen a icon with some sys informations |
403 | local sysinfo | ||
404 | local hostname | ||
405 | local osversion | ||
406 | |||
407 | osversion="$(< /etc/mageversion)" | ||
408 | niro | 342 | hostname=$(mysqldo "select hostname from cfg_network where serial='${ALX_SERIAL}'") |
409 | niro | 304 | sysinfo="Hostname: ${hostname} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)" |
410 | |||
411 | # now get the right position: | ||
412 | # restore orig values of xres | ||
413 | xres="$(( ${xres} + 120 ))" | ||
414 | # default y pos (full yres -22 = cur yres + 58 !) | ||
415 | yres="$(( ${yres} + 58 ))" | ||
416 | # middle of the screen | ||
417 | # (no txt - length required, xtdesk manage that itself) | ||
418 | xres="$(( ${xres} / 2))" | ||
419 | |||
420 | generate_icon \ | ||
421 | --name "${sysinfo}" \ | ||
422 | --command "exit 0" \ | ||
423 | --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ | ||
424 | niro | 2401 | --dest "${dest}/sysinfo.lnk" \ |
425 | niro | 304 | --xres "${xres}" \ |
426 | --yres "${yres}" \ | ||
427 | --icon-width "1" \ | ||
428 | --icon-height "1" | ||
429 | } | ||
430 | |||
431 | niro | 236 | config_sessions() |
432 | { | ||
433 | niro | 272 | local i |
434 | niro | 2149 | local all_ses_ids |
435 | local all_other_ids | ||
436 | niro | 2035 | local CONFIG |
437 | niro | 2149 | local screensaver_passwd_cmd |
438 | niro | 2469 | local fbinit |
439 | local fbkeys | ||
440 | niro | 3503 | local progsh_path |
441 | niro | 236 | |
442 | niro | 3503 | progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
443 | |||
444 | niro | 2149 | # get all session ids from database |
445 | all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'") | ||
446 | niro | 2747 | # get all other_menuitem ids from database |
447 | niro | 2149 | all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'") |
448 | niro | 2747 | # get all plugin ids from database |
449 | all_plugin_ids=$(mysqldo "select id from cfg_plugins where serial='${ALX_SERIAL}'") | ||
450 | niro | 2149 | |
451 | # get screensaver settings | ||
452 | evaluate_table cfg_screensaver | ||
453 | # get autostart settings | ||
454 | evaluate_table cfg_autostart | ||
455 | niro | 2435 | # get current color depth |
456 | evaluate_table cfg_graphic | ||
457 | niro | 2149 | |
458 | niro | 236 | # now setup fluxbox for user station |
459 | |||
460 | # create a fresh fluxbox directory | ||
461 | [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox | ||
462 | install -d ${ALX_UNPRIV_HOME}/.fluxbox | ||
463 | |||
464 | # now generate fluxbox config files | ||
465 | |||
466 | # fluxbox main config | ||
467 | niro | 2469 | if [ -f ${ALX_SKELETONS}/fluxbox/init ] |
468 | then | ||
469 | fbinit="${ALX_SKELETONS}/fluxbox/init" | ||
470 | else | ||
471 | fbinit="/usr/share/fluxbox/init" | ||
472 | fi | ||
473 | cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init | ||
474 | niro | 236 | |
475 | # fluxbox autostart | ||
476 | niro | 2411 | CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps" |
477 | niro | 2454 | # do not show decorations on messages generated with xmessage |
478 | if [ -x /usr/bin/xmessage ] | ||
479 | then | ||
480 | addconfig '[app] (xmessage)' | ||
481 | addconfig ' [Deco] {NONE}' | ||
482 | addconfig '[end]' | ||
483 | fi | ||
484 | niro | 2411 | # add icon utility |
485 | niro | 2454 | [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}' |
486 | niro | 2411 | # add numlock utility |
487 | niro | 2454 | [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}' |
488 | niro | 236 | |
489 | niro | 338 | # add screensaver |
490 | niro | 2149 | if [[ ! -z ${cfg_screensaver_screensaver} ]] && [[ ! -z ${cfg_screensaver_screensaver_timeout} ]] |
491 | niro | 338 | then |
492 | niro | 2149 | if [[ -z ${cfg_screensaver_password} ]] || [[ ${cfg_screensaver_password} = NULL ]] |
493 | niro | 338 | then |
494 | niro | 2149 | screensaver_passwd_cmd="-nolock" |
495 | niro | 338 | else |
496 | niro | 2149 | screensaver_passwd_cmd="-cpasswd $(cryptpw -m des ${cfg_screensaver_password})" |
497 | niro | 338 | fi |
498 | |||
499 | niro | 2149 | addconfig "[startup] {nohup xautolock -time ${cfg_screensaver_timeout} -locker 'xlock -mode ${cfg_screensaver_screensaver} ${screensaver_passwd_cmd}' > /dev/null &}" |
500 | niro | 338 | fi |
501 | |||
502 | niro | 3503 | # add plugins autostart |
503 | for i in ${all_plugin_ids} | ||
504 | do | ||
505 | evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'" | ||
506 | if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]] | ||
507 | then | ||
508 | eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh autostart) | ||
509 | |||
510 | if [[ ${PLUGIN_AUTOSTART} = 1 ]] | ||
511 | then | ||
512 | addconfig "[startup] {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}) &}" | ||
513 | fi | ||
514 | niro | 3504 | # unset all variables |
515 | unset PLUGIN_AUTOSTART | ||
516 | unset PLUGIN_MENUITEM_NAME | ||
517 | niro | 3503 | fi |
518 | done | ||
519 | |||
520 | niro | 246 | # add autostart session |
521 | niro | 2149 | if [[ ! -z ${cfg_autostart_session} ]] |
522 | niro | 246 | then |
523 | niro | 2371 | # sleep one second to wait until busybox is fully initialized and the screen is really centered |
524 | niro | 5013 | addconfig "[startup] {sleep 1 && wfica-launcher ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_autostart_session}) &}" |
525 | niro | 246 | fi |
526 | |||
527 | niro | 236 | # fluxbox hotkeys |
528 | niro | 2469 | if [ -f ${ALX_SKELETONS}/fluxbox/keys ] |
529 | then | ||
530 | fbkeys="${ALX_SKELETONS}/fluxbox/keys" | ||
531 | else | ||
532 | fbkeys="/usr/share/fluxbox/keys" | ||
533 | fi | ||
534 | cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys | ||
535 | niro | 236 | |
536 | niro | 2035 | # generate a fluxbox menu |
537 | niro | 2161 | CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu" |
538 | niro | 2035 | clearconfig |
539 | |||
540 | niro | 236 | # fluxbox menu header |
541 | niro | 2035 | cat ${ALX_SKELETONS}/fluxbox/menu.header >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
542 | niro | 291 | # now fix it with proper messages :P |
543 | local ver="$(< /etc/mageversion)" | ||
544 | niro | 2035 | sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu |
545 | niro | 239 | # add a newline (maybe there is no crlf in the header) |
546 | niro | 2035 | addconfig |
547 | niro | 239 | |
548 | niro | 2149 | # first generate session files |
549 | for i in ${all_ses_ids} | ||
550 | niro | 236 | do |
551 | niro | 2149 | evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'" |
552 | generate_ica_session_file \ | ||
553 | --session "${cfg_sessions_session}" \ | ||
554 | niro | 2161 | --filename "$(fix_whitespaces ${cfg_sessions_filename})" \ |
555 | niro | 2149 | --username "${cfg_sessions_username}" \ |
556 | --password "${cfg_sessions_password}" \ | ||
557 | --domain "${cfg_sessions_domain}" \ | ||
558 | niro | 2435 | --server "${cfg_sessions_browseradrs}" \ |
559 | --colordepth "${cfg_graphic_depth}" | ||
560 | niro | 2149 | |
561 | # fluxbox menusession | ||
562 | niro | 5013 | addconfig "[exec] (${cfg_sessions_session}) {wfica-launcher ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})}" |
563 | niro | 2149 | done |
564 | |||
565 | # delete all progs | ||
566 | [ -d ${progsh_path} ] && rm -rf ${progsh_path} | ||
567 | install -d ${progsh_path} | ||
568 | |||
569 | # add other menuitems | ||
570 | for i in ${all_other_ids} | ||
571 | do | ||
572 | evaluate_table cfg_other_menuitems "where serial='${ALX_SERIAL}' and id='${i}'" | ||
573 | |||
574 | # now echo config line for fluxbox-menu | ||
575 | # make it "configureable" :p | ||
576 | if [[ -n ${cfg_other_menuitems_workdir} ]] | ||
577 | niro | 2035 | then |
578 | niro | 2149 | workdir="--workdir ${cfg_other_menuitems_workdir}" |
579 | niro | 2035 | fi |
580 | niro | 2149 | if [[ -n ${cfg_other_menuitems_icon} ]] |
581 | then | ||
582 | cfg_other_menuitems_icon="<${cfg_other_menuitems_icon}>" | ||
583 | fi | ||
584 | |||
585 | # gen prog startup wrapper | ||
586 | generate_program_sh \ | ||
587 | --name "${cfg_other_menuitems_name}" \ | ||
588 | --exec "${cfg_other_menuitems_exec}" \ | ||
589 | niro | 2161 | --param "${cfg_other_menuitems_param}" \ |
590 | --dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ | ||
591 | "${workdir}" | ||
592 | niro | 2149 | |
593 | niro | 2161 | addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}" |
594 | niro | 236 | done |
595 | |||
596 | niro | 2747 | # add plugins |
597 | for i in ${all_plugin_ids} | ||
598 | do | ||
599 | evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'" | ||
600 | if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]] | ||
601 | then | ||
602 | eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem) | ||
603 | |||
604 | # abort if name or exec is empty | ||
605 | [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue | ||
606 | [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue | ||
607 | |||
608 | # now echo config line for fluxbox-menu | ||
609 | # make it "configureable" :p | ||
610 | if [[ -n ${PLUGIN_MENUITEM_WORKDIR} ]] | ||
611 | then | ||
612 | workdir="--workdir ${PLUGIN_MENUITEM_WORKDIR}" | ||
613 | fi | ||
614 | if [[ -n ${PLUGIN_MENUITEM_ICON} ]] | ||
615 | then | ||
616 | PLUGIN_MENUITEM_ICON="<${PLUGIN_MENUITEM_ICON}>" | ||
617 | fi | ||
618 | |||
619 | # gen prog startup wrapper | ||
620 | generate_program_sh \ | ||
621 | --name "${PLUGIN_MENUITEM_NAME}" \ | ||
622 | --exec "${PLUGIN_MENUITEM_EXEC}" \ | ||
623 | niro | 3455 | --param "${PLUGIN_MENUITEM_PARAM}" \ |
624 | niro | 2747 | --dest "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \ |
625 | "${workdir}" | ||
626 | |||
627 | addconfig "[exec] (${PLUGIN_MENUITEM_NAME}) {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})} ${PLUGIN_MENUITEM_ICON}" | ||
628 | fi | ||
629 | |||
630 | # unset all variables | ||
631 | unset PLUGIN_MENUITEM_NAME | ||
632 | unset PLUGIN_MENUITEM_EXEC | ||
633 | unset PLUGIN_MENUITEM_PARAM | ||
634 | unset PLUGIN_MENUITEM_WORKDIR | ||
635 | unset PLUGIN_MENUITEM_ICON | ||
636 | done | ||
637 | |||
638 | niro | 236 | # fluxbox menu footer |
639 | niro | 2035 | cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
640 | niro | 239 | # add a newline (maybe there is no crlf in the footer) |
641 | niro | 2035 | addconfig |
642 | niro | 236 | |
643 | niro | 304 | # now it's a good time to generate *all* icons :) |
644 | niro | 2747 | generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}" "${all_plugin_ids}" |
645 | niro | 236 | |
646 | niro | 2149 | # fix permissions |
647 | niro | 236 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
648 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox | ||
649 | chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox | ||
650 | niro | 2454 | chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop |
651 | niro | 236 | } |