Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_sessions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

alx-src/trunk/alxconfig-ng/functions/config_sessions.sh revision 291 by niro, Thu Aug 18 02:51:16 2005 UTC alx-src/branches/alxconf-060/functions/config_sessions.sh revision 2401 by niro, Wed Jun 15 12:43:55 2011 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_sessions.sh,v 1.10 2005-08-18 02:51:16 niro Exp $  # $Id$
2  # configures ica-sessions on the host via mysql db settings  # configures ica-sessions on the host via mysql db settings
3    
4  get_sessions_settings()  fix_whitespaces()
5  {  {
6   local x i all count   local var="$@"
7     echo "${var//\ /_}"
  # all arrays:  
  # ->  session1 session2 ... sessionN  
   
  # get settings from database  
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select filename from cfg_sessions where serial='${ALX_SERIAL}'")  
   
  # split'em up and put in an array (only if $all not zero)  
  declare -i i=0  
  if [ -n "${all}" ]  
  then  
  for x in ${all}  
  do  
  ALX_SESSIONS[${i}]=${x}  
  ((i++))  
  done  
  count=${i}  
  else  
  count=0  
  fi  
   
  export ALX_SESSIONS  
8  }  }
9    
10  get_autostart_settings()  # helper function to create citrix session files
11    generate_ica_session_file()
12  {  {
  # get settings from database  
  ALX_AUTOSTART=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select session from cfg_autostart where serial='${ALX_SERIAL}'")  
   
  export ALX_AUTOSTART  
 }  
   
 generate_ica_session_files()  
 {  
  local all_ids  
13   local i   local i
14   local x   local num
15   local server   local server
16   local ses_session   local ses_session
17   local ses_filename   local ses_filename
# Line 50  generate_ica_session_files() Line 19  generate_ica_session_files()
19   local ses_domain   local ses_domain
20   local ses_password   local ses_password
21   local ses_browseradrs   local ses_browseradrs
22   local ses_colors   local CONFIG
23    
24     # very basic getops
25     for i in $*
26     do
27     case $1 in
28     --session) shift; ses_session="$1" ;;
29     --filename) shift; ses_filename="$1" ;;
30     --username) shift; ses_username="$1" ;;
31     --password) shift; ses_password="$1" ;;
32     --domain) shift; ses_domain="$1" ;;
33     --server) shift; ses_browseradrs="$1" ;;
34             esac
35     shift
36     done
37    
38     # abort if session, filename or server not given
39     [[ -z ${ses_session} ]] && return 1
40     [[ -z ${ses_filename} ]] && return 1
41     [[ -z ${ses_browseradrs} ]] && return 1
42    
43     # write session files
44     CONFIG="${ALX_ICA_SESSIONS}/${ses_filename}"
45     clearconfig
46    
47   # get settings from database   addconfig '[WFClient]'
48   all_ids=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   addconfig 'Version=2'
  "select id from cfg_sessions where serial='${ALX_SERIAL}'")  
49    
50   for i in ${all_ids}   # use ';' as ifs
51     declare -i i=0
52     for server in ${ses_browseradrs//;/ }
53   do   do
54   # get settings   (( i++ ))
55   ses_session=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   num="${i}"
56   "select session from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'")   # support newer ica-clients:
57     # the first address must be named TcpBrowserAddress, but not TcpBrowserAddress1 !!
58   ses_filename=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   [[ ${i} -eq 1 ]] && num=""
59   "select filename from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'")   addconfig "TcpBrowserAddress${num}=${server}"
   
  ses_username=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select username from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'")  
   
  ses_domain=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select domain from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'")  
   
  ses_password=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select password from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'")  
   
  ses_browseradrs=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select browseradrs from cfg_sessions where serial='${ALX_SERIAL}' and id='${i}'")  
   
  # get the right colors  
  ses_colors=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select depth from cfg_graphic where serial='${ALX_SERIAL}'")  
  case ${ses_colors} in  
  24) ses_colors="8";;  
  16) ses_colors="4";;  
  8) ses_colors="2";;  
  *) ses_colors="2";;  
  esac  
   
  # write session files  
  echo '[WFClient]' > ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo 'Version=2' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  OLD_IFS="$IFS"  
  IFS=";"  
  declare -i x=0  
  for server in ${ses_browseradrs}  
  do  
  (( x++ ))  
  echo "TcpBrowserAddress${x}=${server}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  done  
  IFS="${OLD_IFS}"  
  unset x  
  unset OLD_IFS  
   
  echo 'ScreenPercent=0' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
   
  echo '[ApplicationServers]' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "${ses_session}=" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
   
  echo "[${ses_session}]" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "Address=${ses_session}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "InitialProgram=#${ses_session}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "DesiredColor=${ses_colors}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo 'TransportDriver=TCP/IP' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo 'WinStationDriver=ICA 3.0' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "ClearPassword=${ses_password}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "Username=${ses_username}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo "Domain=${ses_domain}" >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo 'UseFullScreen=Yes' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo 'NoWindowManager=True' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
60   done   done
61    
62     addconfig 'ScreenPercent=0'
63     addconfig '[ApplicationServers]'
64     addconfig "${ses_session}="
65     addconfig "[${ses_session}]"
66     addconfig "Address=${ses_session}"
67     addconfig "InitialProgram=#${ses_session}"
68     addconfig 'TransportDriver=TCP/IP'
69     addconfig 'WinStationDriver=ICA 3.0'
70     addconfig "ClearPassword=${ses__password}"
71     addconfig "Username=${ses_username}"
72     addconfig "Domain=${ses_domain}"
73     addconfig 'UseFullScreen=Yes'
74     addconfig 'NoWindowManager=True'
75  }  }
76    
77  get_other_menuitems()  # generates a sh file to start programs
78    generate_program_sh()
79  {  {
80   local x i count name exec icon workdir   local dest
81     local name
82     local exec
83     local param
84     local workdir
85     local CONFIG
86    
87   # all arrays:   # very basic getops
88   # ->  session1 session2 ... sessionN   for i in $*
89     do
90     case $1 in
91     --name|-n) shift; name="$1" ;;
92     --exec|-x) shift; exec="$1" ;;
93     --param|-p) shift; param="$1" ;;
94     --dest|-d) shift; dest="$1" ;;
95     --workdir|-w) shift; workdir="$1" ;;
96             esac
97     shift
98     done
99    
100   # get settings from database   # abort if name, dest or exec not given
101   count=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   [[ -z ${name} ]] && return 1
102   "select name from cfg_other_menuitems where serial='${ALX_SERIAL}'")   [[ -z ${exec} ]] && return 1
103     [[ -z ${dest} ]] && return 1
104    
105     CONFIG="${dest}"
106     addconfig "#!/bin/sh"
107     [ -n "${workdir}" ] && addconfig "cd ${workdir}"
108     addconfig "exec ${exec} ${param}"
109    
110   # get all instances and put them into an array   chmod 0755 "${dest}"
111   if [ -n "${count}" ]  }
112    
113    # helper functions for generate all desktop icons
114    generate_icon()
115    {
116     local name
117     local icon
118     local command
119     local dest
120     local yres
121     local xres
122     local iwidth
123     local iheight
124     local deficon
125     local CONFIG
126     local utility
127    
128     # very basic getops
129     for i in $*
130     do
131     case $1 in
132     --name|-n) shift; name="$1" ;;
133     --command|-c) shift; command="$1" ;;
134     --icon|-i) shift; icon="$1" ;;
135     --dest|-d) shift; dest="$1" ;;
136     --xres|-x) shift; xres="$1" ;;
137     --yres|-y) shift; yres="$1" ;;
138     --icon-width|-w) shift; iwidth="$1" ;;
139     --icon-height|-h) shift; iheight="$1" ;;
140     --default-icon) shift; deficon="$1" ;;
141             esac
142     shift
143     done
144    
145     # some sanity checks:
146    
147     # abort if name or command not given
148     [[ -z ${name} ]] && return 1
149     [[ -z ${command} ]] && return 1
150    
151     # which utility are we using idesk|xtdesk ?
152     if [ -x /usr/bin/idesk ]
153     then
154     utility="idesk"
155     [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk"
156     else
157     utility="xtdesk"
158     [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk"
159     fi
160    
161     # use some defaults for icon, dest, {x,y}res
162     [[ -z ${xres} ]] && xres=30
163     [[ -z ${yres} ]] && xres=30
164     if [[ -z ${icon} ]] || [ ! -f ${icon} ]
165   then   then
166   for x in ${count}   # if no default icon is given use default.png
167   do   [[ -z ${deficon} ]] && deficon="default.png"
168   # to be sure   icon="${ALX_SESSIONS_ICONS}/${deficon}"
169   unset name   fi
170   unset exec  
171   unset workdir   CONFIG="${dest}"
172   unset icon   clearconfig
173    
174   name=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   addconfig 'table Icon'
175   "select name from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'")   [[ ${utility} = xtdesk ]] && addconfig '  Type: Program'
176     addconfig "  Caption: ${name}"
177   exec=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   addconfig "  Command: ${command}"
178   "select exec from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'")   addconfig "  Icon: ${icon}"
179     addconfig "  X: ${xres}"
180   workdir=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   addconfig "  Y: ${yres}"
181   "select workdir from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'")  
182     # add these only if not zero
183   icon=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]]
184   "select icon from cfg_other_menuitems where serial='${ALX_SERIAL}' and name='${x}'")   then
185     if [[ ${utility} = xtdesk ]]
186   # debug only   then
187   #echo "DEBUG: ${x}: name:'${name}' exec:'${exec}' workdir:'${workdir}' ic$   addconfig "  IconWidth: ${iwidth}"
188     addconfig "  IconHeight: ${iheight}"
189   # now echo config line for fluxbox-menu   fi
190   # make it "configureable" :P   if [[ ${utility} = idesk ]]
191   [ -n "${workdir}" ] && workdir="cd ${workdir};"   then
192   [ -n "${icon}" ] && icon="[${icon}]"   addconfig "  Width: ${iwidth}"
193   echo "[exec] (${name}) {${workdir}${exec}} ${icon}"   addconfig "  Height: ${iheight}"
194   done   fi
195   fi   fi
196    
197     addconfig 'end'
198    fi
199  }  }
200    
201  config_sessions()  generate_all_desktop_icons()
202  {  {
203   # generate ica session files   local session_list="$1"
204   generate_ica_session_files   local other_menuitem_list="$2"
205     local res
206     local xres
207     local yres
208     local x
209     local y
210     local i
211     local name
212     local progsh_path
213     local utility
214     local dest
215     local rc
216    
217     # which utility are we using idesk|xtdesk ?
218     if [ -x /usr/bin/idesk ]
219     then
220     utility="idesk"
221     dest="${ALX_UNPRIV_HOME}/.idesktop"
222     rc="${ALX_UNPRIV_HOME}/.ideskrc"
223     else
224     utility="xtdesk"
225     dest="${ALX_UNPRIV_HOME}/.xtdesktop"
226     rc="${ALX_UNPRIV_HOME}/.xtdeskrc"
227     fi
228    
  # first of all get the vars  
  get_sessions_settings  
  get_autostart_settings  
229    
230   local count=${#ALX_SESSIONS[*]}   # progsh path
231   local icon   progsh_path="${ALX_UNPRIV_HOME}/.alxprogs"
232   local i  
233     # get the resolution
234     res=$(mysqldo "select resolution from cfg_graphic where serial='${ALX_SERIAL}'")
235    
236     # split res to x & y
237     xres="${res%x*}"
238     yres="${res#*x}"
239    
240     # top left edge of the icon is given in config file
241     # remove a little bit to simulate the bottom-right edge
242     xres="$(( ${xres} - 120 ))"
243     yres="$(( ${yres} - 80 ))"
244    
245     # clean desktop icon location
246     [ -d ${dest} ] && rm -rf ${dest}
247     [ -f ${rc} ] && rm -f ${rc}
248     install -d ${dest}
249    
250    if [[ ${utility} = xtdesk ]]
251    then
252     # basic config
253     cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdesktop/xtdeskrc
254    fi
255    
256     # default settings
257     declare -i x=30
258     declare -i y=30
259    
260     # ica icons
261     for i in ${session_list}
262     do
263     # abort if empty
264     [[ -z ${i} ]] && continue
265    
266     # get database information
267     evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'"
268    
269     # new line if x > xres
270     if [ ${x} -ge ${xres} ]
271     then
272     x=30
273     y=$((${y} + 80))
274     fi
275    
276     # new row if y > yres
277     if [ ${y} -ge ${yres} ]
278     then
279     x=$((${x} + 120))
280     y=30
281    
282     # re-check x
283     [ ${x} -ge ${xres} ] && x=30
284     fi
285    
286     generate_icon \
287     --name "${cfg_sessions_session}" \
288     --command "nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})" \
289     --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_sessions_session}).png" \
290     --dest "${dest}/$(fix_whitespaces ${cfg_sessions_session}).lnk" \
291     --xres "${x}" \
292     --yres "${y}"
293    
294     y=$((${y} + 80))
295     done
296    
297     for i in ${other_menuitem_list}
298     do
299     # abort if empty
300     [[ -z ${i} ]] && continue
301    
302     # get database information
303     evaluate_table cfg_other_menuitems "where serial='${ALX_SERIAL}' and id='${i}'"
304    
305   # DEBUG   # new line if x > xres
306  # declare -i i=0   if [ ${x} -ge ${xres} ]
307  # echo count=${count}   then
308  # echo "Number of new sessions: ${count}"   x=30
309  # for ((i=0; i < count; i++))   y=$((${y} + 80))
310  # do   fi
311  # echo "${i} - ${ALX_SESSIONS[${i}]}"  
312  # done   # new row if y > yres
313     if [ ${y} -ge ${yres} ]
314     then
315     x=$((${x} + 120))
316     y=30
317    
318     # re-check x
319     [ ${x} -ge ${xres} ] && x=30
320     fi
321    
322     generate_icon \
323     --name "${cfg_other_menuitems_name}" \
324     --command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \
325     --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_name}).png" \
326     --dest "${dest}/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \
327     --xres "${x}" \
328     --yres "${y}" \
329     --default-icon "default_item.png"
330    
331     y=$((${y} + 80))
332     done
333    
334     # last but not least gen a icon with some sys informations
335     local sysinfo
336     local hostname
337     local osversion
338    
339     osversion="$(< /etc/mageversion)"
340     hostname=$(mysqldo "select hostname from cfg_network where serial='${ALX_SERIAL}'")
341     sysinfo="Hostname: ${hostname} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)"
342    
343     # now get the right position:
344     # restore orig values of xres
345     xres="$(( ${xres} + 120 ))"
346     # default y pos (full yres -22 = cur yres + 58 !)
347     yres="$(( ${yres} + 58 ))"
348     # middle of the screen
349     # (no txt - length required, xtdesk manage that itself)
350     xres="$(( ${xres} / 2))"
351    
352     generate_icon \
353     --name "${sysinfo}" \
354     --command "exit 0" \
355     --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
356     --dest "${dest}/sysinfo.lnk" \
357     --xres "${xres}" \
358     --yres "${yres}" \
359     --icon-width "1" \
360     --icon-height "1"
361    }
362    
363    config_sessions()
364    {
365     local i
366     local all_ses_ids
367     local all_other_ids
368     local CONFIG
369     local screensaver_passwd_cmd
370    
371     # get all session ids from database
372     all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")
373     # get all other_menutiem ids from database
374     all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'")
375    
376     # get screensaver settings
377     evaluate_table cfg_screensaver
378     # get autostart settings
379     evaluate_table cfg_autostart
380    
381   # now setup fluxbox for user station   # now setup fluxbox for user station
382    
# Line 198  config_sessions() Line 387  config_sessions()
387   # now generate fluxbox config files   # now generate fluxbox config files
388    
389   # fluxbox main config   # fluxbox main config
390   cat ${ALX_SKELETONS}/fluxbox/init \   cat ${ALX_SKELETONS}/fluxbox/init > ${ALX_UNPRIV_HOME}/.fluxbox/init
  > ${ALX_UNPRIV_HOME}/.fluxbox/init  
391    
392   # fluxbox autostart   # fluxbox autostart
393   cat ${ALX_SKELETONS}/fluxbox/apps \   cat ${ALX_SKELETONS}/fluxbox/apps > ${ALX_UNPRIV_HOME}/.fluxbox/apps
394   > ${ALX_UNPRIV_HOME}/.fluxbox/apps  
395     CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
396     # add screensaver
397     if [[ ! -z ${cfg_screensaver_screensaver} ]] && [[ ! -z ${cfg_screensaver_screensaver_timeout} ]]
398     then
399     if [[ -z ${cfg_screensaver_password} ]] || [[ ${cfg_screensaver_password} = NULL ]]
400     then
401     screensaver_passwd_cmd="-nolock"
402     else
403     screensaver_passwd_cmd="-cpasswd $(cryptpw -m des ${cfg_screensaver_password})"
404     fi
405    
406     addconfig "[startup] {nohup xautolock -time ${cfg_screensaver_timeout} -locker 'xlock -mode ${cfg_screensaver_screensaver} ${screensaver_passwd_cmd}' > /dev/null &}"
407     fi
408    
409   # add autostart session   # add autostart session
410   if [[ ${ALX_AUTOSTART} != "" ]]   if [[ ! -z ${cfg_autostart_session} ]]
411   then   then
412   echo "[startup] {wfica ${ALX_ICA_SESSIONS}/${ALX_AUTOSTART}}" \   # sleep one second to wait until busybox is fully initialized and the screen is really centered
413   >> ${ALX_UNPRIV_HOME}/.fluxbox/apps   addconfig "[startup] {sleep 1 && nohup nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_autostart_session}) &}"
414   fi   fi
415    
416   # fluxbox hotkeys   # fluxbox hotkeys
417   cat ${ALX_SKELETONS}/fluxbox/apps \   cat ${ALX_SKELETONS}/fluxbox/keys > ${ALX_UNPRIV_HOME}/.fluxbox/keys
  > ${ALX_UNPRIV_HOME}/.fluxbox/keys  
418    
419   # fluxbox menu header   # generate a fluxbox menu
420   cat ${ALX_SKELETONS}/fluxbox/menu.header \   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu"
421   > ${ALX_UNPRIV_HOME}/.fluxbox/menu   clearconfig
422    
423     # fluxbox menu header
424     cat ${ALX_SKELETONS}/fluxbox/menu.header >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
425   # now fix it with proper messages :P   # now fix it with proper messages :P
426   local ver="$(< /etc/mageversion)"   local ver="$(< /etc/mageversion)"
427   sed -i "s:@CHANGEME@:alx-${ver}  #${ALX_SERIAL}:g" \   sed -i "s:@CHANGEME@:alx-${ver}  #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu
  ${ALX_UNPRIV_HOME}/.fluxbox/menu  
   
428   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
429   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig
430    
431   # fluxbox menu sessions   # first generate session files
432   for (( i=0; i < count; i++ ))   for i in ${all_ses_ids}
433   do   do
434   [ -n "${ALX_SESSIONS[${i}]}" ] && \   evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'"
435   echo "[exec] ($(basename ${ALX_SESSIONS[${i}]} .ica)) {wfica ${ALX_ICA_SESSIONS}/${ALX_SESSIONS[${i}]}}" \   generate_ica_session_file \
436   >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   --session "${cfg_sessions_session}" \
437   done   --filename "$(fix_whitespaces ${cfg_sessions_filename})" \
438     --username "${cfg_sessions_username}" \
439   # add other menuitems   --password "${cfg_sessions_password}" \
440   get_other_menuitems >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   --domain "${cfg_sessions_domain}" \
441     --server "${cfg_sessions_browseradrs}"
  # fluxbox menu footer  
  cat ${ALX_SKELETONS}/fluxbox/menu.footer \  
  >> ${ALX_UNPRIV_HOME}/.fluxbox/menu  
442    
443   # add a newline (maybe there is no crlf in the footer)   # fluxbox menusession
444   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig "[exec] (${cfg_sessions_session}) {nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})}"
445     done
446    
447   # now we generate the desktop icons   # delete all progs
448   cat ${ALX_SKELETONS}/idesk/ideskrc \   progsh_path="${ALX_UNPRIV_HOME}/.alxprogs"
449   > ${ALX_UNPRIV_HOME}/.ideskrc   [ -d ${progsh_path} ] && rm -rf ${progsh_path}
450     install -d ${progsh_path}
  # whipe out old stuff and install a fresh directory  
  [ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop  
  install -d ${ALX_UNPRIV_HOME}/.idesktop  
451    
452   local name   # add other menuitems
453   for (( i=0; i < count; i++ ))   for i in ${all_other_ids}
454   do   do
455   name="$(basename ${ALX_SESSIONS[${i}]} .ica)"   evaluate_table cfg_other_menuitems "where serial='${ALX_SERIAL}' and id='${i}'"
456    
457   if [ -f ${ALX_SESSIONS_ICONS}/${name}.png ]   # now echo config line for fluxbox-menu
458     # make it "configureable" :p
459     if [[ -n ${cfg_other_menuitems_workdir} ]]
460   then   then
461   icon="${ALX_SESSIONS_ICONS}/${name}.png"   workdir="--workdir ${cfg_other_menuitems_workdir}"
462   else   fi
463   icon="${ALX_SESSIONS_ICONS}/default.png"   if [[ -n ${cfg_other_menuitems_icon} ]]
464     then
465     cfg_other_menuitems_icon="<${cfg_other_menuitems_icon}>"
466   fi   fi
467    
468   echo "table Icon   # gen prog startup wrapper
469  Caption: ${name}   generate_program_sh \
470  Command: wfica ${ALX_ICA_SESSIONS}/${name}.ica   --name "${cfg_other_menuitems_name}" \
471  Icon: ${icon}   --exec "${cfg_other_menuitems_exec}" \
472  end" > ${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk   --param "${cfg_other_menuitems_param}" \
473     --dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \
474     "${workdir}"
475    
476     addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}"
477   done   done
478    
479   # set correct permissions   # fluxbox menu footer
480     cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
481     # add a newline (maybe there is no crlf in the footer)
482     addconfig
483    
484     # now it's a good time to generate *all* icons :)
485     generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}"
486    
487     # fix permissions
488   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
489   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
490   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
491   chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop
492   chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc
   
   
  # unset vars  
  unset ALX_SESSIONS  
493  }  }

Legend:
Removed from v.291  
changed lines
  Added in v.2401