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