Magellan Linux

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

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

revision 2161 by niro, Wed May 18 14:35:13 2011 UTC revision 7977 by niro, Thu Dec 10 09:09:40 2015 UTC
# Line 7  fix_whitespaces() Line 7  fix_whitespaces()
7   echo "${var//\ /_}"   echo "${var//\ /_}"
8  }  }
9    
10    sanitize_store()
11    {
12     local var="$@"
13     echo "$(fix_whitespaces ${var})" | sed -e 's:\::_:g' -e 's:\/:_:g' | tr '[A-Z]' '[a-z]'
14    }
15    
16  # helper function to create citrix session files  # helper function to create citrix session files
17  generate_ica_session_file()  generate_ica_session_file()
18  {  {
# Line 19  generate_ica_session_file() Line 25  generate_ica_session_file()
25   local ses_domain   local ses_domain
26   local ses_password   local ses_password
27   local ses_browseradrs   local ses_browseradrs
28     local ses_colors
29   local CONFIG   local CONFIG
30    
31   # very basic getops   # very basic getops
# Line 31  generate_ica_session_file() Line 38  generate_ica_session_file()
38   --password) shift; ses_password="$1" ;;   --password) shift; ses_password="$1" ;;
39   --domain) shift; ses_domain="$1" ;;   --domain) shift; ses_domain="$1" ;;
40   --server) shift; ses_browseradrs="$1" ;;   --server) shift; ses_browseradrs="$1" ;;
41           esac   --colordepth) shift; ses_colors="$1" ;;
42     esac
43   shift   shift
44   done   done
45    
# Line 57  generate_ica_session_file() Line 65  generate_ica_session_file()
65   # the first address must be named TcpBrowserAddress, but not TcpBrowserAddress1 !!   # the first address must be named TcpBrowserAddress, but not TcpBrowserAddress1 !!
66   [[ ${i} -eq 1 ]] && num=""   [[ ${i} -eq 1 ]] && num=""
67   addconfig "TcpBrowserAddress${num}=${server}"   addconfig "TcpBrowserAddress${num}=${server}"
68     addconfig "HttpBrowserAddress${num}=${server}"
69   done   done
70    
71   addconfig 'ScreenPercent=0'   addconfig 'ScreenPercent=0'
# Line 65  generate_ica_session_file() Line 74  generate_ica_session_file()
74   addconfig "[${ses_session}]"   addconfig "[${ses_session}]"
75   addconfig "Address=${ses_session}"   addconfig "Address=${ses_session}"
76   addconfig "InitialProgram=#${ses_session}"   addconfig "InitialProgram=#${ses_session}"
77    
78     # convert to ica session file values
79     case ${ses_colors} in
80     24|32) ses_colors="8";;
81     16) ses_colors="4";;
82     8) ses_colors="2";;
83     *) ses_colors="4";; # default to 16bit
84     esac
85     addconfig "DesiredColor=${ses_colors}"
86   addconfig 'TransportDriver=TCP/IP'   addconfig 'TransportDriver=TCP/IP'
87   addconfig 'WinStationDriver=ICA 3.0'   addconfig 'WinStationDriver=ICA 3.0'
88   addconfig "ClearPassword=${ses__password}"   addconfig "ClearPassword=${ses_password}"
89   addconfig "Username=${ses_username}"   addconfig "Username=${ses_username}"
90   addconfig "Domain=${ses_domain}"   addconfig "Domain=${ses_domain}"
91   addconfig 'UseFullScreen=Yes'   addconfig 'UseFullScreen=Yes'
92   addconfig 'NoWindowManager=True'   addconfig 'NoWindowManager=True'
93  }  }
94    
95    generate_storefront_sh()
96    {
97     local server
98     local ses_session
99     local ses_filename
100     local ses_username
101     local ses_domain
102     local ses_password
103     local ses_browseradrs
104     local method
105     local ses_method
106     local name
107    
108     # very basic getops
109     for i in $*
110     do
111     case $1 in
112     --session) shift; ses_session="$1" ;;
113     --filename) shift; ses_filename="$1" ;;
114     --username) shift; ses_username="$1" ;;
115     --password) shift; ses_password="$1" ;;
116     --domain) shift; ses_domain="$1" ;;
117     --server) shift; ses_browseradrs="$1" ;;
118     --method) shift; method="$1" ;;
119     esac
120     shift
121     done
122    
123     # abort if name, dest or exec not given
124     [[ -z ${ses_filename} ]] && return 1
125     [[ -z ${ses_username} ]] && return 1
126     [[ -z ${ses_password} ]] && return 1
127     [[ -z ${ses_domain} ]] && return 1
128     [[ -z ${ses_browseradrs} ]] && return 1
129    
130     case "${method}" in
131     enumerate)
132     ses_method="${method}"
133     name="store-enumerate"
134     ;;
135     launch)
136     ses_method="${method}"
137     name="${ses_session}"
138     [[ -z ${ses_session} ]] && return 1
139     ;;
140     *) echo "generate_storefront_sh(): wrong method given, either 'launch' or 'enumerate' are allowed."
141     return 1
142     ;;
143     esac
144    
145     generate_program_sh \
146     --name "${name}" \
147     --exec "storefront-resolver" \
148     --param "${method} '${ses_username}' '${ses_password}' '${ses_domain}' '${ses_session}'" \
149     --dest "${ALX_UNPRIV_HOME}/.alxprogs/$(fix_whitespaces ${ses_filename})" \
150     --environment "STORE=${ses_browseradrs}"
151    }
152    
153  # generates a sh file to start programs  # generates a sh file to start programs
154  generate_program_sh()  generate_program_sh()
155  {  {
# Line 93  generate_program_sh() Line 169  generate_program_sh()
169   --param|-p) shift; param="$1" ;;   --param|-p) shift; param="$1" ;;
170   --dest|-d) shift; dest="$1" ;;   --dest|-d) shift; dest="$1" ;;
171   --workdir|-w) shift; workdir="$1" ;;   --workdir|-w) shift; workdir="$1" ;;
172           esac   --environment|-e)  shift; environment="$1" ;;
173     esac
174   shift   shift
175   done   done
176    
# Line 104  generate_program_sh() Line 181  generate_program_sh()
181    
182   CONFIG="${dest}"   CONFIG="${dest}"
183   addconfig "#!/bin/sh"   addconfig "#!/bin/sh"
184   [ -n "${workdir}" ] && addconfig "cd ${workdir}"   [[ -n ${environment} ]] && addconfig "export ${environment}"
185     [[ -n ${workdir} ]] && addconfig "cd ${workdir}"
186   addconfig "exec ${exec} ${param}"   addconfig "exec ${exec} ${param}"
187    
188   chmod 0755 "${dest}"   chmod 0755 "${dest}"
# Line 123  generate_icon() Line 201  generate_icon()
201   local iheight   local iheight
202   local deficon   local deficon
203   local CONFIG   local CONFIG
204     local utility
205    
206   # very basic getops   # very basic getops
207   for i in $*   for i in $*
# Line 137  generate_icon() Line 216  generate_icon()
216   --icon-width|-w) shift; iwidth="$1" ;;   --icon-width|-w) shift; iwidth="$1" ;;
217   --icon-height|-h) shift; iheight="$1" ;;   --icon-height|-h) shift; iheight="$1" ;;
218   --default-icon) shift; deficon="$1" ;;   --default-icon) shift; deficon="$1" ;;
219           esac   esac
220   shift   shift
221   done   done
222    
223   # some sanity checks:   # some sanity checks:
224    
225   # abort if name or command not given   # abort if name or command not given
226   [[ -z ${name} ]] && return 1   [[ -z ${name} ]] && return 1
227   [[ -z ${command} ]] && return 1   [[ -z ${command} ]] && return 1
228    
229     [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk"
230    
231   # use some defaults for icon, dest, {x,y}res   # use some defaults for icon, dest, {x,y}res
232   [[ -z ${xres} ]] && xres=30   [[ -z ${xres} ]] && xres=50
233   [[ -z ${yres} ]] && xres=30   [[ -z ${yres} ]] && xres=50
  [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk"  
234   if [[ -z ${icon} ]] || [ ! -f ${icon} ]   if [[ -z ${icon} ]] || [ ! -f ${icon} ]
235   then   then
236   # if no default icon is given use default.png   # if no default icon is given use default.png
# Line 162  generate_icon() Line 242  generate_icon()
242   clearconfig   clearconfig
243    
244   addconfig 'table Icon'   addconfig 'table Icon'
  addconfig '  Type: Program'  
245   addconfig "  Caption: ${name}"   addconfig "  Caption: ${name}"
246   addconfig "  Command: ${command}"   addconfig "  Command: ${command}"
247   addconfig "  Icon: ${icon}"   addconfig "  Icon: ${icon}"
# Line 172  generate_icon() Line 251  generate_icon()
251   # add these only if not zero   # add these only if not zero
252   if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]]   if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]]
253   then   then
254   addconfig "  IconWidth: ${iwidth}"   addconfig "  Width: ${iwidth}"
255   addconfig "  IconHeight: ${iheight}"   addconfig "  Height: ${iheight}"
256   fi   fi
257    
258   addconfig 'end'   addconfig 'end'
# Line 183  generate_all_desktop_icons() Line 262  generate_all_desktop_icons()
262  {  {
263   local session_list="$1"   local session_list="$1"
264   local other_menuitem_list="$2"   local other_menuitem_list="$2"
265     local plugin_list="$3"
266   local res   local res
267   local xres   local xres
268   local yres   local yres
# Line 191  generate_all_desktop_icons() Line 271  generate_all_desktop_icons()
271   local i   local i
272   local name   local name
273   local progsh_path   local progsh_path
274     local utility
275     local dest
276     local rc
277    
278     dest="${ALX_UNPRIV_HOME}/.idesktop"
279     rc="${ALX_UNPRIV_HOME}/.ideskrc"
280    
281   # progsh path   # progsh path
282   progsh_path="${ALX_UNPRIV_HOME}/.alxprogs"   progsh_path="${ALX_UNPRIV_HOME}/.alxprogs"
# Line 200  generate_all_desktop_icons() Line 286  generate_all_desktop_icons()
286    
287   # split res to x & y   # split res to x & y
288   xres="${res%x*}"   xres="${res%x*}"
289   xres="${res#*x}"   yres="${res#*x}"
290    
291   # top left edge of the icon is given in config file   # top left edge of the icon is given in config file
292   # remove a little bit to simulate the bottom-right edge   # remove a little bit to simulate the bottom-right edge
293   xres="$(( ${xres} - 120 ))"   xres="$(( ${xres} - 120 ))"
294   yres="$(( ${yres} - 80 ))"   yres="$(( ${yres} - 80 ))"
295    
  # basic config  
  cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc  
   
296   # clean desktop icon location   # clean desktop icon location
297   [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop   [ -d ${dest} ] && rm -rf ${dest}
298   install -d ${ALX_UNPRIV_HOME}/.xtdesktop   [ -f ${rc} ] && rm -f ${rc}
299     install -d ${dest}
300    
301   # default settings   # default settings
302   declare -i x=30   declare -i x=50
303   declare -i y=30   declare -i y=50
304    
305   # ica icons   # ica icons
306   for i in ${session_list}   for i in ${session_list}
# Line 230  generate_all_desktop_icons() Line 314  generate_all_desktop_icons()
314   # new line if x > xres   # new line if x > xres
315   if [ ${x} -ge ${xres} ]   if [ ${x} -ge ${xres} ]
316   then   then
317   x=30   x=50
318   y=$((${y} + 80))   y=$((${y} + 80))
319   fi   fi
320    
# Line 238  generate_all_desktop_icons() Line 322  generate_all_desktop_icons()
322   if [ ${y} -ge ${yres} ]   if [ ${y} -ge ${yres} ]
323   then   then
324   x=$((${x} + 120))   x=$((${x} + 120))
325   y=30   y=50
326    
327   # re-check x   # re-check x
328   [ ${x} -ge ${xres} ] && x=30   [ ${x} -ge ${xres} ] && x=50
329   fi   fi
330    
331   generate_icon \   generate_icon \
332   --name "${cfg_session_session}" \   --name "${cfg_sessions_session}" \
333   --command "nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_session_filename})" \   --command "${progsh_path}/$(fix_whitespaces ${cfg_sessions_filename})" \
334   --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_session_session}).png" \   --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_sessions_session}).png" \
335   --dest "${ALX_UNPRIV_HOME}/.xtdesktop/$(fix_whitespaces ${cfg_session_session}).lnk" \   --dest "${dest}/$(fix_whitespaces ${cfg_sessions_session}).lnk" \
336   --xres "${x}" \   --xres "${x}" \
337   --yres "${y}"   --yres "${y}"
338    
# Line 266  generate_all_desktop_icons() Line 350  generate_all_desktop_icons()
350   # new line if x > xres   # new line if x > xres
351   if [ ${x} -ge ${xres} ]   if [ ${x} -ge ${xres} ]
352   then   then
353   x=30   x=50
354   y=$((${y} + 80))   y=$((${y} + 80))
355   fi   fi
356    
# Line 274  generate_all_desktop_icons() Line 358  generate_all_desktop_icons()
358   if [ ${y} -ge ${yres} ]   if [ ${y} -ge ${yres} ]
359   then   then
360   x=$((${x} + 120))   x=$((${x} + 120))
361   y=30   y=50
362    
363   # re-check x   # re-check x
364   [ ${x} -ge ${xres} ] && x=30   [ ${x} -ge ${xres} ] && x=50
365   fi   fi
366    
367   generate_icon \   generate_icon \
368   --name "${cfg_other_menuitems_name}" \   --name "${cfg_other_menuitems_name}" \
369   --command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_exec})" \   --command "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \
370   --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_name}).png" \   --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${cfg_other_menuitems_icon}).png" \
371   --dest "${ALX_UNPRIV_HOME}/.xtdesktop/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \   --dest "${dest}/$(fix_whitespaces ${cfg_other_menuitems_name}).lnk" \
372   --xres "${x}" \   --xres "${x}" \
373   --yres "${y}" \   --yres "${y}" \
374   --default-icon "default_item.png"   --default-icon "default_item.png"
375    
376   y=$((${y} + 80))   y=$((${y} + 80))
377   done   done
378    
379     for i in ${plugin_list}
380     do
381     # abort if empty
382     [[ -z ${i} ]] && continue
383    
384     evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
385     if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]]
386     then
387     eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem)
388    
389     # abort if name or exec is empty
390     [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue
391     [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue
392    
393     # new line if x > xres
394     if [ ${x} -ge ${xres} ]
395     then
396     x=50
397     y=$((${y} + 80))
398     fi
399    
400     # new row if y > yres
401     if [ ${y} -ge ${yres} ]
402     then
403     x=$((${x} + 120))
404     y=50
405    
406     # re-check x
407     [ ${x} -ge ${xres} ] && x=50
408     fi
409    
410     generate_icon \
411     --name "${PLUGIN_MENUITEM_NAME}" \
412     --command "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \
413     --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).png" \
414     --dest "${dest}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).lnk" \
415     --xres "${x}" \
416     --yres "${y}" \
417     --default-icon "default_item.png"
418    
419     y=$((${y} + 80))
420     fi
421    
422     # unset all variables
423     unset PLUGIN_MENUITEM_NAME
424     unset PLUGIN_MENUITEM_EXEC
425     unset PLUGIN_MENUITEM_PARAM
426     unset PLUGIN_MENUITEM_WORKDIR
427     unset PLUGIN_MENUITEM_ICON
428     done
429    
430     # add shutdown, reboot icons
431     for i in shutdown reboot
432     do
433     # new line if x > xres
434     if [ ${x} -ge ${xres} ]
435     then
436     x=50
437     y=$((${y} + 80))
438     fi
439    
440     # new row if y > yres
441     if [ ${y} -ge ${yres} ]
442     then
443     x=$((${x} + 120))
444     y=50
445    
446     # re-check x
447     [ ${x} -ge ${xres} ] && x=50
448     fi
449    
450     case ${i} in
451     shutdown) name="Herunterfahren" ;;
452     reboot) name="Neustarten" ;;
453     esac
454    
455     generate_icon \
456     --name "${name}" \
457     --command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \
458     --icon "${ALX_SESSIONS_ICONS}/${i}.png" \
459     --dest "${dest}/${i}.lnk" \
460     --xres "${x}" \
461     --yres "${y}" \
462     --icon-width "40" \
463     --icon-height "40"
464    
465     y=$((${y} + 80))
466     done
467    
468   # last but not least gen a icon with some sys informations   # last but not least gen a icon with some sys informations
469   local sysinfo   local sysinfo
# Line 314  generate_all_desktop_icons() Line 487  generate_all_desktop_icons()
487   --name "${sysinfo}" \   --name "${sysinfo}" \
488   --command "exit 0" \   --command "exit 0" \
489   --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \   --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
490   --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \   --dest "${dest}/sysinfo.lnk" \
491   --xres "${xres}" \   --xres "${xres}" \
492   --yres "${yres}" \   --yres "${yres}" \
493   --icon-width "1" \   --icon-width "1" \
# Line 328  config_sessions() Line 501  config_sessions()
501   local all_other_ids   local all_other_ids
502   local CONFIG   local CONFIG
503   local screensaver_passwd_cmd   local screensaver_passwd_cmd
504     local fbinit
505     local fbkeys
506     local progsh_path
507     local storefront_enumerate=0
508     local storefront_store
509     local _store
510     local all_storefront_stores=""
511    
512     progsh_path="${ALX_UNPRIV_HOME}/.alxprogs"
513    
514   # get all session ids from database   # get all session ids from database
515   all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")   all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")
516   # get all other_menutiem ids from database   # get all other_menuitem ids from database
517   all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'")   all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'")
518     # get all plugin ids from database
519     all_plugin_ids=$(mysqldo "select id from cfg_plugins where serial='${ALX_SERIAL}'")
520    
521   # get screensaver settings   # get screensaver settings
522   evaluate_table cfg_screensaver   evaluate_table cfg_screensaver
523   # get autostart settings   # get autostart settings
524   evaluate_table cfg_autostart   evaluate_table cfg_autostart
525     # get current color depth
526     evaluate_table cfg_graphic
527    
528   # now setup fluxbox for user station   # now setup fluxbox for user station
529    
# Line 348  config_sessions() Line 534  config_sessions()
534   # now generate fluxbox config files   # now generate fluxbox config files
535    
536   # fluxbox main config   # fluxbox main config
537   cat ${ALX_SKELETONS}/fluxbox/init > ${ALX_UNPRIV_HOME}/.fluxbox/init   if [ -f ${ALX_SKELETONS}/fluxbox/init ]
538     then
539     fbinit="${ALX_SKELETONS}/fluxbox/init"
540     else
541     fbinit="/usr/share/fluxbox/init"
542     fi
543     cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init
544    
545   # fluxbox autostart   # fluxbox autostart
  cat ${ALX_SKELETONS}/fluxbox/apps > ${ALX_UNPRIV_HOME}/.fluxbox/apps  
   
546   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
547     # do not show decorations on messages generated with xmessage
548     if [ -x /usr/bin/xmessage ]
549     then
550     addconfig '[app] (xmessage)'
551     addconfig ' [Deco] {NONE}'
552     addconfig '[end]'
553     fi
554     # never show decorations with the ica client
555     addconfig '[app] (Wfica)'
556     addconfig ' [Deco] {NONE}'
557     addconfig '[end]'
558     # add icon utility
559     [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}'
560     # add numlock utility
561     [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}'
562    
563   # add screensaver   # add screensaver
564   if [[ ! -z ${cfg_screensaver_screensaver} ]] && [[ ! -z ${cfg_screensaver_screensaver_timeout} ]]   if [[ ! -z ${cfg_screensaver_screensaver} ]] && [[ ! -z ${cfg_screensaver_screensaver_timeout} ]]
565   then   then
# Line 367  config_sessions() Line 573  config_sessions()
573   addconfig "[startup] {nohup xautolock -time ${cfg_screensaver_timeout} -locker 'xlock -mode ${cfg_screensaver_screensaver} ${screensaver_passwd_cmd}' > /dev/null &}"   addconfig "[startup] {nohup xautolock -time ${cfg_screensaver_timeout} -locker 'xlock -mode ${cfg_screensaver_screensaver} ${screensaver_passwd_cmd}' > /dev/null &}"
574   fi   fi
575    
576   # add autostart session   # add plugins autostart
577   if [[ ! -z ${cfg_autostart_session} ]]   for i in ${all_plugin_ids}
578   then   do
579   addconfig "[startup] {nohup nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_autostart_session}) &}"   evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
580   fi   if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]]
581     then
582     eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh autostart)
583    
584     if [[ ${PLUGIN_AUTOSTART} = 1 ]]
585     then
586     addconfig "[startup] {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}) &}"
587     fi
588     # unset all variables
589     unset PLUGIN_AUTOSTART
590     unset PLUGIN_MENUITEM_NAME
591     fi
592     done
593    
594   # fluxbox hotkeys   # fluxbox hotkeys
595   cat ${ALX_SKELETONS}/fluxbox/keys > ${ALX_UNPRIV_HOME}/.fluxbox/keys   if [ -f ${ALX_SKELETONS}/fluxbox/keys ]
596     then
597     fbkeys="${ALX_SKELETONS}/fluxbox/keys"
598     else
599     fbkeys="/usr/share/fluxbox/keys"
600     fi
601     cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys
602    
603   # generate a fluxbox menu   # generate a fluxbox menu
604   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu"   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu"
# Line 388  config_sessions() Line 612  config_sessions()
612   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
613   addconfig   addconfig
614    
615     # delete all progs
616     [ -d ${progsh_path} ] && rm -rf ${progsh_path}
617     install -d ${progsh_path}
618    
619   # first generate session files   # first generate session files
620   for i in ${all_ses_ids}   for i in ${all_ses_ids}
621   do   do
622   evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'"   evaluate_table cfg_sessions "where serial='${ALX_SERIAL}' and id='${i}'"
623   generate_ica_session_file \  
624   --session "${cfg_sessions_session}" \   # generate STOREFRONT/PNABROWSE compatible session
625   --filename "$(fix_whitespaces ${cfg_sessions_filename})" \   case "${cfg_sessions_browseradrs}" in
626   --username "${cfg_sessions_username}" \   "http://"*|"https://"* )
627   --password "${cfg_sessions_password}" \   # run storefront_enumerate on startup to get all available sessions
628   --domain "${cfg_sessions_domain}" \   storefront_enumerate=1
629   --server "${cfg_sessions_browseradrs}"   storefront_store="$(sanitize_store ${cfg_sessions_browseradrs})"
630     store_found=0
631     for _store in ${all_storefront_stores}
632     do
633     if [[ ${storefront_store} = ${_store} ]]
634     then
635     store_found=1
636     fi
637     done
638     if [[ ${store_found} = 0 ]]
639     then
640     all_storefront_stores="${all_storefront_stores} ${storefront_store}"
641     generate_storefront_sh \
642     --method "enumerate" \
643     --filename "store-enumerate_${storefront_store}_.sh" \
644     --username "${cfg_sessions_username}" \
645     --password "${cfg_sessions_password}" \
646     --domain "${cfg_sessions_domain}" \
647     --server "${cfg_sessions_browseradrs}"
648     fi
649    
650     # generate STOREFRONT/PNABROWSE compatible session
651     generate_storefront_sh \
652     --method "launch" \
653     --session "${cfg_sessions_session}" \
654     --filename "$(fix_whitespaces ${cfg_sessions_filename})" \
655     --username "${cfg_sessions_username}" \
656     --password "${cfg_sessions_password}" \
657     --domain "${cfg_sessions_domain}" \
658     --server "${cfg_sessions_browseradrs}"
659     ;;
660     *)
661     # generate ICA compatible session
662     generate_ica_session_file \
663     --session "${cfg_sessions_session}" \
664     --filename "$(fix_whitespaces ${cfg_sessions_filename})" \
665     --username "${cfg_sessions_username}" \
666     --password "${cfg_sessions_password}" \
667     --domain "${cfg_sessions_domain}" \
668     --server "${cfg_sessions_browseradrs}" \
669     --colordepth "${cfg_graphic_depth}"
670     # gen prog startup wrapper
671     generate_program_sh \
672     --name "$(fix_whitespaces ${cfg_sessions_filename})" \
673     --exec "wfica-launcher" \
674     --param "${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})" \
675     --dest "${progsh_path}/$(fix_whitespaces ${cfg_sessions_filename})" \
676     "${workdir}"
677     ;;
678     esac
679    
680   # fluxbox menusession   # fluxbox menusession
681   addconfig "[exec] (${cfg_sessions_session}) {nice -n 19 wfica ${ALX_ICA_SESSIONS}/$(fix_whitespaces ${cfg_sessions_filename})}"   addconfig "[exec] (${cfg_sessions_session}) {${progsh_path}/$(fix_whitespaces ${cfg_sessions_filename})}"
682   done   done
683     if [[ ${storefront_enumerate} = 1 ]]
684   # delete all progs   then
685   progsh_path="${ALX_UNPRIV_HOME}/.alxprogs"   for _store in ${all_storefront_stores}
686   [ -d ${progsh_path} ] && rm -rf ${progsh_path}   do
687   install -d ${progsh_path}   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
688     addconfig "[startup] {${progsh_path}/store-enumerate_${_store}_.sh &}"
689     done
690     fi
691    
692   # add other menuitems   # add other menuitems
693   for i in ${all_other_ids}   for i in ${all_other_ids}
# Line 433  config_sessions() Line 713  config_sessions()
713   --dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \   --dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \
714   "${workdir}"   "${workdir}"
715    
716     CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu"
717   addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}"   addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}"
718   done   done
719    
720     # add plugins
721     for i in ${all_plugin_ids}
722     do
723     evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
724     if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]]
725     then
726     eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem)
727    
728     # abort if name or exec is empty
729     [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue
730     [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue
731    
732     # now echo config line for fluxbox-menu
733     # make it "configureable" :p
734     if [[ -n ${PLUGIN_MENUITEM_WORKDIR} ]]
735     then
736     workdir="--workdir ${PLUGIN_MENUITEM_WORKDIR}"
737     fi
738     if [[ -n ${PLUGIN_MENUITEM_ICON} ]]
739     then
740     PLUGIN_MENUITEM_ICON="<${PLUGIN_MENUITEM_ICON}>"
741     fi
742    
743     # gen prog startup wrapper
744     generate_program_sh \
745     --name "${PLUGIN_MENUITEM_NAME}" \
746     --exec "${PLUGIN_MENUITEM_EXEC}" \
747     --param "${PLUGIN_MENUITEM_PARAM}" \
748     --dest "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \
749     "${workdir}"
750    
751     CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu"
752     addconfig "[exec] (${PLUGIN_MENUITEM_NAME}) {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})} ${PLUGIN_MENUITEM_ICON}"
753     fi
754    
755     # unset all variables
756     unset PLUGIN_MENUITEM_NAME
757     unset PLUGIN_MENUITEM_EXEC
758     unset PLUGIN_MENUITEM_PARAM
759     unset PLUGIN_MENUITEM_WORKDIR
760     unset PLUGIN_MENUITEM_ICON
761     done
762    
763     # add autostart session
764     if [[ ! -z ${cfg_autostart_session} ]]
765     then
766     CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
767     # sleep one second to wait until busybox is fully initialized and the screen is really centered
768     addconfig "[startup] {sleep 1 && ${progsh_path}/$(fix_whitespaces ${cfg_autostart_session}) &}"
769     fi
770    
771   # fluxbox menu footer   # fluxbox menu footer
772   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu"
773     cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${CONFIG}
774   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
775   addconfig   addconfig
776    
777   # now it's a good time to generate *all* icons :)   # now it's a good time to generate *all* icons :)
778   generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}"   generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}" "${all_plugin_ids}"
779    
780   # fix permissions   # fix permissions
781   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
782   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
783   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
784   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop   chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop
  chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc  
785  }  }

Legend:
Removed from v.2161  
changed lines
  Added in v.7977