Contents of /alx-src/branches/alxconf-060/functions/config_sessions.sh
Parent Directory | Revision Log
Revision 5618 -
(show annotations)
(download)
(as text)
Thu Apr 24 07:42:50 2014 UTC (10 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 16498 byte(s)
Thu Apr 24 07:42:50 2014 UTC (10 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 16498 byte(s)
-add HttpBroweserAddresses also
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 | # generates a sh file to start programs |
90 | generate_program_sh() |
91 | { |
92 | local dest |
93 | local name |
94 | local exec |
95 | local param |
96 | local workdir |
97 | local CONFIG |
98 | |
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 | --param|-p) shift; param="$1" ;; |
106 | --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 | [[ -z ${name} ]] && return 1 |
114 | [[ -z ${exec} ]] && return 1 |
115 | [[ -z ${dest} ]] && return 1 |
116 | |
117 | CONFIG="${dest}" |
118 | addconfig "#!/bin/sh" |
119 | [ -n "${workdir}" ] && addconfig "cd ${workdir}" |
120 | addconfig "exec ${exec} ${param}" |
121 | |
122 | chmod 0755 "${dest}" |
123 | } |
124 | |
125 | # 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 | local deficon |
137 | local CONFIG |
138 | local utility |
139 | |
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 | --default-icon) shift; deficon="$1" ;; |
153 | esac |
154 | shift |
155 | done |
156 | |
157 | # some sanity checks: |
158 | |
159 | # abort if name or command not given |
160 | [[ -z ${name} ]] && return 1 |
161 | [[ -z ${command} ]] && return 1 |
162 | |
163 | [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk" |
164 | |
165 | # use some defaults for icon, dest, {x,y}res |
166 | [[ -z ${xres} ]] && xres=50 |
167 | [[ -z ${yres} ]] && xres=50 |
168 | if [[ -z ${icon} ]] || [ ! -f ${icon} ] |
169 | then |
170 | # if no default icon is given use default.png |
171 | [[ -z ${deficon} ]] && deficon="default.png" |
172 | icon="${ALX_SESSIONS_ICONS}/${deficon}" |
173 | fi |
174 | |
175 | CONFIG="${dest}" |
176 | clearconfig |
177 | |
178 | 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 | # add these only if not zero |
186 | if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]] |
187 | then |
188 | addconfig " Width: ${iwidth}" |
189 | addconfig " Height: ${iheight}" |
190 | fi |
191 | |
192 | addconfig 'end' |
193 | } |
194 | |
195 | generate_all_desktop_icons() |
196 | { |
197 | local session_list="$1" |
198 | local other_menuitem_list="$2" |
199 | local plugin_list="$3" |
200 | local res |
201 | local xres |
202 | local yres |
203 | local x |
204 | local y |
205 | local i |
206 | local name |
207 | local progsh_path |
208 | local utility |
209 | local dest |
210 | local rc |
211 | |
212 | dest="${ALX_UNPRIV_HOME}/.idesktop" |
213 | rc="${ALX_UNPRIV_HOME}/.ideskrc" |
214 | |
215 | # progsh path |
216 | progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
217 | |
218 | # get the resolution |
219 | res=$(mysqldo "select resolution from cfg_graphic where serial='${ALX_SERIAL}'") |
220 | |
221 | # split res to x & y |
222 | xres="${res%x*}" |
223 | yres="${res#*x}" |
224 | |
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 | [ -d ${dest} ] && rm -rf ${dest} |
232 | [ -f ${rc} ] && rm -f ${rc} |
233 | install -d ${dest} |
234 | |
235 | # default settings |
236 | declare -i x=50 |
237 | declare -i y=50 |
238 | |
239 | # ica icons |
240 | for i in ${session_list} |
241 | do |
242 | # abort if empty |
243 | [[ -z ${i} ]] && continue |
244 | |
245 | # get database information |
246 | evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'" |
247 | |
248 | # new line if x > xres |
249 | if [ ${x} -ge ${xres} ] |
250 | then |
251 | x=50 |
252 | y=$((${y} + 80)) |
253 | fi |
254 | |
255 | # new row if y > yres |
256 | if [ ${y} -ge ${yres} ] |
257 | then |
258 | x=$((${x} + 120)) |
259 | y=50 |
260 | |
261 | # re-check x |
262 | [ ${x} -ge ${xres} ] && x=50 |
263 | fi |
264 | |
265 | generate_icon \ |
266 | --name "${cfg_sessions_session}" \ |
267 | --command "wfica-launcher ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})" \ |
268 | --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_sessions_session}).png" \ |
269 | --dest "${dest}/$(fix_whitespaces ${cfg_sessions_session}).lnk" \ |
270 | --xres "${x}" \ |
271 | --yres "${y}" |
272 | |
273 | y=$((${y} + 80)) |
274 | done |
275 | |
276 | for i in ${other_menuitem_list} |
277 | do |
278 | # abort if empty |
279 | [[ -z ${i} ]] && continue |
280 | |
281 | # get database information |
282 | evaluate_table cfg_other_menuitems "where serial='${ALX_SERIAL}' and id='${i}'" |
283 | |
284 | # new line if x > xres |
285 | if [ ${x} -ge ${xres} ] |
286 | then |
287 | x=50 |
288 | y=$((${y} + 80)) |
289 | fi |
290 | |
291 | # new row if y > yres |
292 | if [ ${y} -ge ${yres} ] |
293 | then |
294 | x=$((${x} + 120)) |
295 | y=50 |
296 | |
297 | # re-check x |
298 | [ ${x} -ge ${xres} ] && x=50 |
299 | fi |
300 | |
301 | generate_icon \ |
302 | --name "${cfg_other_menuitems_name}" \ |
303 | --command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ |
304 | --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_name}).png" \ |
305 | --dest "${dest}/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \ |
306 | --xres "${x}" \ |
307 | --yres "${y}" \ |
308 | --default-icon "default_item.png" |
309 | |
310 | y=$((${y} + 80)) |
311 | done |
312 | |
313 | for i in ${plugin_list} |
314 | do |
315 | # abort if empty |
316 | [[ -z ${i} ]] && continue |
317 | |
318 | 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 | |
323 | # 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 | # 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 | x=50 |
371 | y=$((${y} + 80)) |
372 | fi |
373 | |
374 | # new row if y > yres |
375 | if [ ${y} -ge ${yres} ] |
376 | then |
377 | x=$((${x} + 120)) |
378 | y=50 |
379 | |
380 | # re-check x |
381 | [ ${x} -ge ${xres} ] && x=50 |
382 | fi |
383 | |
384 | case ${i} in |
385 | shutdown) name="Herunterfahren" ;; |
386 | reboot) name="Neustarten" ;; |
387 | 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 | --yres "${y}" \ |
396 | --icon-width "40" \ |
397 | --icon-height "40" |
398 | |
399 | y=$((${y} + 80)) |
400 | done |
401 | |
402 | # 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 | hostname=$(mysqldo "select hostname from cfg_network where serial='${ALX_SERIAL}'") |
409 | 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 | --dest "${dest}/sysinfo.lnk" \ |
425 | --xres "${xres}" \ |
426 | --yres "${yres}" \ |
427 | --icon-width "1" \ |
428 | --icon-height "1" |
429 | } |
430 | |
431 | config_sessions() |
432 | { |
433 | local i |
434 | local all_ses_ids |
435 | local all_other_ids |
436 | local CONFIG |
437 | local screensaver_passwd_cmd |
438 | local fbinit |
439 | local fbkeys |
440 | local progsh_path |
441 | |
442 | progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
443 | |
444 | # get all session ids from database |
445 | all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'") |
446 | # get all other_menuitem ids from database |
447 | all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'") |
448 | # get all plugin ids from database |
449 | all_plugin_ids=$(mysqldo "select id from cfg_plugins where serial='${ALX_SERIAL}'") |
450 | |
451 | # get screensaver settings |
452 | evaluate_table cfg_screensaver |
453 | # get autostart settings |
454 | evaluate_table cfg_autostart |
455 | # get current color depth |
456 | evaluate_table cfg_graphic |
457 | |
458 | # 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 | 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 | |
475 | # fluxbox autostart |
476 | CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps" |
477 | # 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 | # add icon utility |
485 | [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}' |
486 | # add numlock utility |
487 | [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}' |
488 | |
489 | # add screensaver |
490 | if [[ ! -z ${cfg_screensaver_screensaver} ]] && [[ ! -z ${cfg_screensaver_screensaver_timeout} ]] |
491 | then |
492 | if [[ -z ${cfg_screensaver_password} ]] || [[ ${cfg_screensaver_password} = NULL ]] |
493 | then |
494 | screensaver_passwd_cmd="-nolock" |
495 | else |
496 | screensaver_passwd_cmd="-cpasswd $(cryptpw -m des ${cfg_screensaver_password})" |
497 | fi |
498 | |
499 | addconfig "[startup] {nohup xautolock -time ${cfg_screensaver_timeout} -locker 'xlock -mode ${cfg_screensaver_screensaver} ${screensaver_passwd_cmd}' > /dev/null &}" |
500 | fi |
501 | |
502 | # 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 | # unset all variables |
515 | unset PLUGIN_AUTOSTART |
516 | unset PLUGIN_MENUITEM_NAME |
517 | fi |
518 | done |
519 | |
520 | # add autostart session |
521 | if [[ ! -z ${cfg_autostart_session} ]] |
522 | then |
523 | # sleep one second to wait until busybox is fully initialized and the screen is really centered |
524 | addconfig "[startup] {sleep 1 && wfica-launcher ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_autostart_session}) &}" |
525 | fi |
526 | |
527 | # fluxbox hotkeys |
528 | 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 | |
536 | # generate a fluxbox menu |
537 | CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu" |
538 | clearconfig |
539 | |
540 | # fluxbox menu header |
541 | cat ${ALX_SKELETONS}/fluxbox/menu.header >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
542 | # now fix it with proper messages :P |
543 | local ver="$(< /etc/mageversion)" |
544 | sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu |
545 | # add a newline (maybe there is no crlf in the header) |
546 | addconfig |
547 | |
548 | # first generate session files |
549 | for i in ${all_ses_ids} |
550 | do |
551 | evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'" |
552 | generate_ica_session_file \ |
553 | --session "${cfg_sessions_session}" \ |
554 | --filename "$(fix_whitespaces ${cfg_sessions_filename})" \ |
555 | --username "${cfg_sessions_username}" \ |
556 | --password "${cfg_sessions_password}" \ |
557 | --domain "${cfg_sessions_domain}" \ |
558 | --server "${cfg_sessions_browseradrs}" \ |
559 | --colordepth "${cfg_graphic_depth}" |
560 | |
561 | # fluxbox menusession |
562 | addconfig "[exec] (${cfg_sessions_session}) {wfica-launcher ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})}" |
563 | 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 | then |
578 | workdir="--workdir ${cfg_other_menuitems_workdir}" |
579 | fi |
580 | 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 | --param "${cfg_other_menuitems_param}" \ |
590 | --dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ |
591 | "${workdir}" |
592 | |
593 | addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}" |
594 | done |
595 | |
596 | # 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 | --param "${PLUGIN_MENUITEM_PARAM}" \ |
624 | --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 | # fluxbox menu footer |
639 | cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
640 | # add a newline (maybe there is no crlf in the footer) |
641 | addconfig |
642 | |
643 | # now it's a good time to generate *all* icons :) |
644 | generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}" "${all_plugin_ids}" |
645 | |
646 | # fix permissions |
647 | 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 | chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop |
651 | } |