Annotation of /alx-src/trunk/tinyalxconfig-ng/functions/config_sessions.sh
Parent Directory | Revision Log
Revision 386 -
(hide annotations)
(download)
(as text)
Wed Jun 4 16:47:56 2008 UTC (15 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 14509 byte(s)
Wed Jun 4 16:47:56 2008 UTC (15 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 14509 byte(s)
-initial import
1 | niro | 386 | # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_sessions.sh,v 1.1 2008-06-04 16:47:56 niro Exp $ |
2 | # configures ica-sessions on the host via mysql db settings | ||
3 | |||
4 | get_sessions_settings() | ||
5 | { | ||
6 | local x i all count | ||
7 | |||
8 | # all arrays: | ||
9 | # -> session1 session2 ... sessionN | ||
10 | |||
11 | # get settings from database | ||
12 | all=$(mysqldo "select filename from cfg_sessions where serial='${ALX_SERIAL}'") | ||
13 | |||
14 | # split'em up and put in an array (only if $all not zero) | ||
15 | declare -i i=0 | ||
16 | if [ -n "${all}" ] | ||
17 | then | ||
18 | for x in ${all} | ||
19 | do | ||
20 | ALX_SESSIONS[${i}]=${x} | ||
21 | ((i++)) | ||
22 | done | ||
23 | count=${i} | ||
24 | else | ||
25 | count=0 | ||
26 | fi | ||
27 | |||
28 | # get settings from database | ||
29 | ALX_PROGRAMS=$(mysqldo "select name from cfg_other_menuitems where serial='${ALX_SERIAL}'") | ||
30 | |||
31 | export ALX_SESSIONS | ||
32 | export ALX_PROGRAMS | ||
33 | } | ||
34 | |||
35 | get_autostart_settings() | ||
36 | { | ||
37 | # get settings from database | ||
38 | ALX_AUTOSTART=$(mysqldo "select session from cfg_autostart where serial='${ALX_SERIAL}'") | ||
39 | |||
40 | export ALX_AUTOSTART | ||
41 | } | ||
42 | |||
43 | get_screensaver_settings() | ||
44 | { | ||
45 | ALX_SCRN_SAVER=$(mysqldo "select screensaver from cfg_screensaver where serial='${ALX_SERIAL}'") | ||
46 | ALX_SCRN_TIMEOUT=$(mysqldo "select timeout from cfg_screensaver where serial='${ALX_SERIAL}'") | ||
47 | ALX_SCRN_PASSWD=$(mysqldo "select password from cfg_screensaver where serial='${ALX_SERIAL}'") | ||
48 | |||
49 | export ALX_SCRN_SAVER | ||
50 | export ALX_SCRN_TIMEOUT | ||
51 | export ALX_SCRN_PASSWD | ||
52 | } | ||
53 | |||
54 | generate_ica_session_files() | ||
55 | { | ||
56 | local all_ids | ||
57 | local i | ||
58 | local x | ||
59 | local server | ||
60 | local ses_session | ||
61 | local ses_filename | ||
62 | local ses_username | ||
63 | local ses_domain | ||
64 | local ses_password | ||
65 | local ses_browseradrs | ||
66 | local ses_colors | ||
67 | local ses_display_mode | ||
68 | local ses_display_x | ||
69 | local ses_display_y | ||
70 | |||
71 | # get settings from database | ||
72 | all_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'") | ||
73 | |||
74 | for i in ${all_ids} | ||
75 | do | ||
76 | # get settings | ||
77 | ses_session=$(mysqldo "select session from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
78 | ses_filename=$(mysqldo "select filename from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
79 | ses_username=$(mysqldo "select username from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
80 | ses_domain=$(mysqldo "select domain from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
81 | ses_password=$(mysqldo "select password from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
82 | ses_browseradrs=$(mysqldo "select browseradrs from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
83 | |||
84 | # get the session display mode seamless|fullscreen|or an resolution | ||
85 | ses_display_mode=$(mysqldo "select displaymode from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'") | ||
86 | |||
87 | # get the right colors | ||
88 | ses_colors=$(mysqldo "select depth from cfg_graphic where serial='${ALX_SERIAL}'") | ||
89 | # convert to ica session file values | ||
90 | case ${ses_colors} in | ||
91 | 24) ses_colors="8";; | ||
92 | 16) ses_colors="4";; | ||
93 | 8) ses_colors="2";; | ||
94 | *) ses_colors="2";; | ||
95 | esac | ||
96 | |||
97 | # write session files | ||
98 | echo '[WFClient]' > ${ALX_ICA_SESSIONS}/${ses_filename} | ||
99 | echo 'Version=2' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
100 | OLD_IFS="$IFS" | ||
101 | IFS=";" | ||
102 | declare -i x=0 | ||
103 | for server in ${ses_browseradrs} | ||
104 | do | ||
105 | (( x++ )) | ||
106 | echo "TcpBrowserAddress${x}=${server}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
107 | done | ||
108 | IFS="${OLD_IFS}" | ||
109 | unset x | ||
110 | unset OLD_IFS | ||
111 | |||
112 | echo 'ScreenPercent=0' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
113 | |||
114 | echo '[ApplicationServers]' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
115 | echo "${ses_session}=" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
116 | |||
117 | echo "[${ses_session}]" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
118 | echo "Address=${ses_session}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
119 | echo "InitialProgram=#${ses_session}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
120 | echo "DesiredColor=${ses_colors}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
121 | echo 'TransportDriver=TCP/IP' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
122 | echo 'WinStationDriver=ICA 3.0' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
123 | echo "ClearPassword=${ses_password}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
124 | echo "Username=${ses_username}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
125 | echo "Domain=${ses_domain}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
126 | |||
127 | # use the right display settings | ||
128 | case ${ses_display_mode} in | ||
129 | # fullscreen mode | ||
130 | fullscreen) | ||
131 | echo 'UseFullScreen=Yes' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
132 | echo 'NoWindowManager=True' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
133 | ;; | ||
134 | # seamless window mode | ||
135 | seamless) | ||
136 | echo 'TWIMode=On' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
137 | ;; | ||
138 | # a desired resolution | ||
139 | *x*) | ||
140 | # split the resolutions | ||
141 | ses_display_x=$(echo ${ses_display_mode} | cut -dx -f1) | ||
142 | ses_display_y=$(echo ${ses_display_mode} | cut -dx -f2) | ||
143 | echo "DesiredHRES=${ses_display_x}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
144 | echo "DesiredVRES=${ses_display_x}" >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
145 | ;; | ||
146 | # but default to fullscreen if nothing met | ||
147 | *) | ||
148 | echo 'UseFullScreen=Yes' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
149 | echo 'NoWindowManager=True' >> ${ALX_ICA_SESSIONS}/${ses_filename} | ||
150 | ;; | ||
151 | esac | ||
152 | done | ||
153 | } | ||
154 | |||
155 | # generates a sh file to start programs | ||
156 | generate_program_sh() | ||
157 | { | ||
158 | local dest | ||
159 | local name | ||
160 | local exec | ||
161 | local workdir | ||
162 | |||
163 | # very basic getops | ||
164 | for i in $* | ||
165 | do | ||
166 | case $1 in | ||
167 | --name|-n) shift; name="$1" ;; | ||
168 | --exec|-x) shift; exec="$1" ;; | ||
169 | --dest|-d) shift; dest="$1" ;; | ||
170 | --workdir|-w) shift; workdir="$1" ;; | ||
171 | esac | ||
172 | shift | ||
173 | done | ||
174 | |||
175 | # abort if name, dest or exec not given | ||
176 | [ -z "${name}" ] && return 1 | ||
177 | [ -z "${exec}" ] && return 1 | ||
178 | [ -z "${dest}" ] && return 1 | ||
179 | |||
180 | echo "#!/bin/sh" > ${dest} | ||
181 | [ -n "${workdir}" ] && echo "cd ${workdir}" >> ${dest} | ||
182 | echo "exec ${exec}" >> ${dest} | ||
183 | |||
184 | chmod 0755 ${dest} | ||
185 | } | ||
186 | |||
187 | get_other_menuitems() | ||
188 | { | ||
189 | local x i progsh_path name exec icon workdir | ||
190 | |||
191 | # all arrays: | ||
192 | # -> session1 session2 ... sessionN | ||
193 | |||
194 | # get settings from database -> now stored in ALX_PROGRAMS | ||
195 | |||
196 | # abort if empty | ||
197 | [ -z "${ALX_PROGRAMS}" ] && return 0 | ||
198 | |||
199 | progsh_path=${ALX_UNPRIV_HOME}/.alxprogs | ||
200 | [ -d ${progsh_path} ] && rm -rf ${progsh_path} | ||
201 | install -d ${progsh_path} | ||
202 | |||
203 | # gen menu items | ||
204 | for x in ${ALX_PROGRAMS} | ||
205 | do | ||
206 | # to be sure | ||
207 | unset name | ||
208 | unset exec | ||
209 | unset workdir | ||
210 | unset icon | ||
211 | |||
212 | name=$(mysqldo "select name from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'") | ||
213 | exec=$(mysqldo "select exec from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'") | ||
214 | workdir=$(mysqldo "select workdir from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'") | ||
215 | icon=$(mysqldo "select icon from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'") | ||
216 | |||
217 | # now echo config line for fluxbox-menu | ||
218 | # make it "configureable" :P | ||
219 | [ -n "${workdir}" ] && workdir="--workdir ${workdir}" | ||
220 | [ -n "${icon}" ] && icon="<${icon}>" | ||
221 | |||
222 | # gen prog startup wrapper | ||
223 | generate_program_sh \ | ||
224 | --name "${name}" \ | ||
225 | --exec "${exec}" \ | ||
226 | --dest "${progsh_path}/${name}" \ | ||
227 | "${workdir}" | ||
228 | |||
229 | echo "[exec] (${name}) {${progsh_path}/${name}} ${icon}" | ||
230 | done | ||
231 | } | ||
232 | |||
233 | # helper functions for generate all desktop icons | ||
234 | generate_icon() | ||
235 | { | ||
236 | local name | ||
237 | local icon | ||
238 | local command | ||
239 | local dest | ||
240 | local yres | ||
241 | local xres | ||
242 | local iwidth | ||
243 | local iheight | ||
244 | local deficon | ||
245 | |||
246 | # very basic getops | ||
247 | for i in $* | ||
248 | do | ||
249 | case $1 in | ||
250 | --name|-n) shift; name="$1" ;; | ||
251 | --command|-c) shift; command="$1" ;; | ||
252 | --icon|-i) shift; icon="$1" ;; | ||
253 | --dest|-d) shift; dest="$1" ;; | ||
254 | --xres|-x) shift; xres="$1" ;; | ||
255 | --yres|-y) shift; yres="$1" ;; | ||
256 | --icon-width|-w) shift; iwidth="$1" ;; | ||
257 | --icon-height|-h) shift; iheight="$1" ;; | ||
258 | --default-icon) shift; deficon="$1" ;; | ||
259 | esac | ||
260 | shift | ||
261 | done | ||
262 | |||
263 | # some sanity checks : | ||
264 | |||
265 | # abort if name or command not given | ||
266 | [ -z "${name}" ] && return 1 | ||
267 | [ -z "${command}" ] && return 1 | ||
268 | |||
269 | # use some defaults for icon, dest, {x,y}res | ||
270 | [ -z "${xres}" ] && xres=20 | ||
271 | [ -z "${yres}" ] && xres=20 | ||
272 | [ -z "${dest}" ] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk" | ||
273 | if [ -z "${icon}" ] || [ ! -f "${icon}" ] | ||
274 | then | ||
275 | # if no default icon is given use default.png | ||
276 | [ -z "${deficon}" ] && deficon="default.png" | ||
277 | icon="${ALX_SESSIONS_ICONS}/${deficon}" | ||
278 | fi | ||
279 | |||
280 | echo "table Icon" > ${dest} | ||
281 | echo " Type: Program" >> ${dest} | ||
282 | echo " Caption: ${name}" >> ${dest} | ||
283 | echo " Command: ${command}" >> ${dest} | ||
284 | echo " Icon: ${icon}" >> ${dest} | ||
285 | echo " X: ${xres}" >> ${dest} | ||
286 | echo " Y: ${yres}" >> ${dest} | ||
287 | |||
288 | # add these only if not zero | ||
289 | if [ -n "${iwidth}" ] && [ -n "${iheight}" ] | ||
290 | then | ||
291 | echo " IconWidth: ${iwidth}" >> ${dest} | ||
292 | echo " IconHeight: ${iheight}" >> ${dest} | ||
293 | fi | ||
294 | |||
295 | echo "end" >> ${dest} | ||
296 | } | ||
297 | |||
298 | generate_all_desktop_icons() | ||
299 | { | ||
300 | local res | ||
301 | local xres | ||
302 | local yres | ||
303 | local icon_list | ||
304 | local x | ||
305 | local y | ||
306 | local item | ||
307 | local basename_item | ||
308 | local progsh_path | ||
309 | |||
310 | # get the resolution | ||
311 | res=$(mysqldo "select resolution from cfg_graphic where serial='${ALX_SERIAL}'") | ||
312 | |||
313 | # split res to x & y | ||
314 | xres="$(echo ${res} | cut -dx -f1)" | ||
315 | yres="$(echo ${res} | cut -dx -f2)" | ||
316 | |||
317 | # top left edge of the icon is given in config file | ||
318 | # remove a little bit to simulate the bottom-right edge | ||
319 | xres="$(( ${xres} - 120 ))" | ||
320 | yres="$(( ${yres} - 80 ))" | ||
321 | |||
322 | # basic config | ||
323 | cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc | ||
324 | |||
325 | # clean desktop icon location | ||
326 | [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop | ||
327 | install -d ${ALX_UNPRIV_HOME}/.xtdesktop | ||
328 | |||
329 | |||
330 | # default settings | ||
331 | declare -i x=20 | ||
332 | declare -i y=20 | ||
333 | |||
334 | # first all ica sessions | ||
335 | local count=${#ALX_SESSIONS[*]} | ||
336 | for (( i=0; i < count; i++ )) | ||
337 | do | ||
338 | # filenames ! | ||
339 | icon_list="${icon_list} ${ALX_SESSIONS[${i}]}" | ||
340 | done | ||
341 | |||
342 | for item in ${icon_list} | ||
343 | do | ||
344 | # abort if empty | ||
345 | [ -z "${item}" ] && continue | ||
346 | |||
347 | # new line if x > xres | ||
348 | if [ ${x} -ge ${xres} ];then | ||
349 | x=20 | ||
350 | y=$((${y} + 80)) | ||
351 | fi | ||
352 | |||
353 | # new row if y > yres | ||
354 | if [ ${y} -ge ${yres} ];then | ||
355 | x=$((${x} + 120)) | ||
356 | y=20 | ||
357 | |||
358 | # re-check x | ||
359 | [ ${x} -ge ${xres} ] && x=20 | ||
360 | fi | ||
361 | |||
362 | # ica icons | ||
363 | # get basename (.ica must be suffix) | ||
364 | basename_item="$(basename ${item} .ica)" | ||
365 | generate_icon \ | ||
366 | --name "${basename_item}" \ | ||
367 | --command "nice -n 19 wfica ${ALX_ICA_SESSIONS}/${item}" \ | ||
368 | --icon "${ALX_SESSIONS_ICONS}/${basename_item}.png" \ | ||
369 | --dest "${ALX_UNPRIV_HOME}/.xtdesktop/${basename_item}.lnk" \ | ||
370 | --xres "${x}" \ | ||
371 | --yres "${y}" | ||
372 | |||
373 | y=$((${y} + 80)) | ||
374 | done | ||
375 | |||
376 | |||
377 | # generate program icons | ||
378 | icon_list="${ALX_PROGRAMS}" | ||
379 | |||
380 | progsh_path=${ALX_UNPRIV_HOME}/.alxprogs | ||
381 | |||
382 | for item in ${icon_list} | ||
383 | do | ||
384 | # abort if empty | ||
385 | [ -z "${item}" ] && continue | ||
386 | |||
387 | # new line if x > xres | ||
388 | if [ ${x} -ge ${xres} ];then | ||
389 | x=20 | ||
390 | y=$((${y} + 80)) | ||
391 | fi | ||
392 | |||
393 | # new row if y > yres | ||
394 | if [ ${y} -ge ${yres} ];then | ||
395 | x=$((${x} + 120)) | ||
396 | y=20 | ||
397 | |||
398 | # re-check x | ||
399 | [ ${x} -ge ${xres} ] && x=20 | ||
400 | fi | ||
401 | |||
402 | generate_icon \ | ||
403 | --name "${item}" \ | ||
404 | --command "${progsh_path}/${item}" \ | ||
405 | --icon "${ALX_SESSIONS_ICONS}/${item}.png" \ | ||
406 | --dest "${ALX_UNPRIV_HOME}/.xtdesktop/${item}.lnk" \ | ||
407 | --xres "${x}" \ | ||
408 | --yres "${y}" \ | ||
409 | --default-icon "default_item.png" | ||
410 | |||
411 | y=$((${y} + 80)) | ||
412 | done | ||
413 | |||
414 | |||
415 | |||
416 | # last but not least gen a icon with some sys informations | ||
417 | local sysinfo | ||
418 | local hostname | ||
419 | local osversion | ||
420 | |||
421 | osversion="$(< /etc/mageversion)" | ||
422 | hostname=$(mysqldo "select hostname from cfg_network where serial='${ALX_SERIAL}'") | ||
423 | sysinfo="Hostname: ${hostname} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)" | ||
424 | |||
425 | # now get the right position: | ||
426 | # restore orig values of xres | ||
427 | xres="$(( ${xres} + 120 ))" | ||
428 | # default y pos (full yres -22 = cur yres + 58 !) | ||
429 | yres="$(( ${yres} + 58 ))" | ||
430 | # middle of the screen | ||
431 | # (no txt - length required, xtdesk manage that itself) | ||
432 | xres="$(( ${xres} / 2))" | ||
433 | |||
434 | generate_icon \ | ||
435 | --name "${sysinfo}" \ | ||
436 | --command "exit 0" \ | ||
437 | --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ | ||
438 | --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ | ||
439 | --xres "${xres}" \ | ||
440 | --yres "${yres}" \ | ||
441 | --icon-width "1" \ | ||
442 | --icon-height "1" | ||
443 | } | ||
444 | |||
445 | config_sessions() | ||
446 | { | ||
447 | # generate ica session files | ||
448 | generate_ica_session_files | ||
449 | |||
450 | # first of all get the vars | ||
451 | get_sessions_settings | ||
452 | get_autostart_settings | ||
453 | get_screensaver_settings | ||
454 | |||
455 | local count=${#ALX_SESSIONS[*]} | ||
456 | local icon | ||
457 | local i | ||
458 | |||
459 | # now setup fluxbox for user station | ||
460 | |||
461 | # create a fresh fluxbox directory | ||
462 | [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox | ||
463 | install -d ${ALX_UNPRIV_HOME}/.fluxbox | ||
464 | |||
465 | # now generate fluxbox config files | ||
466 | |||
467 | # fluxbox main config | ||
468 | cat ${ALX_SKELETONS}/fluxbox/init \ | ||
469 | > ${ALX_UNPRIV_HOME}/.fluxbox/init | ||
470 | |||
471 | # fluxbox autostart | ||
472 | cat ${ALX_SKELETONS}/fluxbox/apps \ | ||
473 | > ${ALX_UNPRIV_HOME}/.fluxbox/apps | ||
474 | |||
475 | # add screensaver | ||
476 | if [[ -n ${ALX_SCRN_SAVER} ]] && [[ -n ${ALX_SCRN_TIMEOUT} ]] | ||
477 | then | ||
478 | local ALX_PASSWD_CMD | ||
479 | |||
480 | if [[ -z ${ALX_SCRN_PASSWD} ]] || [[ ${ALX_SCRN_PASSWD} = NULL ]] | ||
481 | then | ||
482 | ALX_PASSWD_CMD="-nolock" | ||
483 | else | ||
484 | ALX_PASSWD_CMD="-cpasswd $(openssl passwd ${ALX_SCRN_PASSWD})" | ||
485 | fi | ||
486 | |||
487 | echo "[startup] {nohup xautolock -time ${ALX_SCRN_TIMEOUT} -locker 'xlock -mode ${ALX_SCRN_SAVER} ${ALX_PASSWD_CMD}' > /dev/null &}" \ | ||
488 | >> ${ALX_UNPRIV_HOME}/.fluxbox/apps | ||
489 | fi | ||
490 | |||
491 | # add autostart session | ||
492 | if [[ ${ALX_AUTOSTART} != "" ]] | ||
493 | then | ||
494 | echo "[startup] {nice -n 19 wfica ${ALX_ICA_SESSIONS}/${ALX_AUTOSTART}}" \ | ||
495 | >> ${ALX_UNPRIV_HOME}/.fluxbox/apps | ||
496 | fi | ||
497 | |||
498 | # fluxbox hotkeys | ||
499 | cat ${ALX_SKELETONS}/fluxbox/keys \ | ||
500 | > ${ALX_UNPRIV_HOME}/.fluxbox/keys | ||
501 | |||
502 | # fluxbox menu header | ||
503 | cat ${ALX_SKELETONS}/fluxbox/menu.header \ | ||
504 | > ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
505 | |||
506 | # now fix it with proper messages :P | ||
507 | local ver="$(< /etc/mageversion)" | ||
508 | sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" \ | ||
509 | ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
510 | |||
511 | # add a newline (maybe there is no crlf in the header) | ||
512 | echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
513 | |||
514 | # fluxbox menu sessions | ||
515 | for (( i=0; i < count; i++ )) | ||
516 | do | ||
517 | [ -n "${ALX_SESSIONS[${i}]}" ] && \ | ||
518 | echo "[exec] ($(basename ${ALX_SESSIONS[${i}]} .ica)) {nice -n 19 wfica ${ALX_ICA_SESSIONS}/${ALX_SESSIONS[${i}]}}" \ | ||
519 | >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
520 | done | ||
521 | |||
522 | # add other menuitems | ||
523 | get_other_menuitems >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
524 | |||
525 | # fluxbox menu footer | ||
526 | cat ${ALX_SKELETONS}/fluxbox/menu.footer \ | ||
527 | >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
528 | |||
529 | # add a newline (maybe there is no crlf in the footer) | ||
530 | echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
531 | |||
532 | # now it's a good time to generate *all* icons :) | ||
533 | generate_all_desktop_icons | ||
534 | |||
535 | # set correct permissions | ||
536 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} | ||
537 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox | ||
538 | chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox | ||
539 | chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop | ||
540 | chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc | ||
541 | |||
542 | # unset vars | ||
543 | unset ALX_SESSIONS | ||
544 | unset ALX_PROGRAMS | ||
545 | unset ALX_SCRN_SAVER | ||
546 | unset ALX_SCRN_TIMEOUT | ||
547 | unset ALX_SCRN_PASSWD | ||
548 | } | ||
549 |