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