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