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 2001 by niro, Mon May 9 14:51:55 2011 UTC revision 2035 by niro, Wed May 11 09:11:02 2011 UTC
# Line 65  generate_ica_session_files() Line 65  generate_ica_session_files()
65   local ses_password   local ses_password
66   local ses_browseradrs   local ses_browseradrs
67   local ses_colors   local ses_colors
68     local CONFIG
69    
70   # get settings from database   # get settings from database
71   all_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")   all_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")
# Line 90  generate_ica_session_files() Line 91  generate_ica_session_files()
91   esac   esac
92    
93   # write session files   # write session files
94   echo '[WFClient]' > ${ALX_ICA_SESSIONS}/${ses_filename}   CONFIG=${ALX_ICA_SESSIONS}/${ses_filename}
95   echo 'Version=2' >> ${ALX_ICA_SESSIONS}/${ses_filename}   clearconfig
96    
97     addconfig '[WFClient]'
98     addconfig 'Version=2'
99   OLD_IFS="$IFS"   OLD_IFS="$IFS"
100   IFS=";"   IFS=";"
101   declare -i x=0   declare -i x=0
# Line 102  generate_ica_session_files() Line 106  generate_ica_session_files()
106   # support newer ica-clients:   # support newer ica-clients:
107   # the first address must be named TcpBrowserAddress, but not TcpBrowserAddress1 !!   # the first address must be named TcpBrowserAddress, but not TcpBrowserAddress1 !!
108   [[ ${x} -eq 1 ]] && browser_address_num=""   [[ ${x} -eq 1 ]] && browser_address_num=""
109   echo "TcpBrowserAddress${browser_address_num}=${server}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "TcpBrowserAddress${browser_address_num}=${server}"
110   done   done
111   IFS="${OLD_IFS}"   IFS="${OLD_IFS}"
112   unset x   unset x
113   unset OLD_IFS   unset OLD_IFS
114    
115   echo 'ScreenPercent=0' >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig 'ScreenPercent=0'
116     addconfig '[ApplicationServers]'
117   echo '[ApplicationServers]' >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "${ses_session}="
118   echo "${ses_session}=" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "[${ses_session}]"
119     addconfig "Address=${ses_session}"
120   echo "[${ses_session}]" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "InitialProgram=#${ses_session}"
121   echo "Address=${ses_session}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "DesiredColor=${ses_colors}"
122   echo "InitialProgram=#${ses_session}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig 'TransportDriver=TCP/IP'
123   echo "DesiredColor=${ses_colors}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig 'WinStationDriver=ICA 3.0'
124   echo 'TransportDriver=TCP/IP' >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "ClearPassword=${ses_password}"
125   echo 'WinStationDriver=ICA 3.0' >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "Username=${ses_username}"
126   echo "ClearPassword=${ses_password}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig "Domain=${ses_domain}"
127   echo "Username=${ses_username}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig 'UseFullScreen=Yes'
128   echo "Domain=${ses_domain}" >> ${ALX_ICA_SESSIONS}/${ses_filename}   addconfig 'NoWindowManager=True'
  echo 'UseFullScreen=Yes' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
  echo 'NoWindowManager=True' >> ${ALX_ICA_SESSIONS}/${ses_filename}  
129   done   done
130  }  }
131    
# Line 134  generate_program_sh() Line 136  generate_program_sh()
136   local name   local name
137   local exec   local exec
138   local workdir   local workdir
139     local CONFIG
140    
141   # very basic getops   # very basic getops
142   for i in $*   for i in $*
# Line 152  generate_program_sh() Line 155  generate_program_sh()
155   [ -z "${exec}" ] && return 1   [ -z "${exec}" ] && return 1
156   [ -z "${dest}" ] && return 1   [ -z "${dest}" ] && return 1
157    
158   echo "#!/bin/sh" > ${dest}   CONFIG=${dest}
159   [ -n "${workdir}" ] && echo "cd ${workdir}" >> ${dest}   addconfig "#!/bin/sh"
160   echo "exec ${exec}" >> ${dest}   [ -n "${workdir}" ] && addconfig "cd ${workdir}"
161     addconfig "exec ${exec}"
162    
163   chmod 0755 ${dest}   chmod 0755 ${dest}
164  }  }
# Line 217  generate_icon() Line 221  generate_icon()
221   local iwidth   local iwidth
222   local iheight   local iheight
223   local deficon   local deficon
224     local CONFIG
225    
226   # very basic getops   # very basic getops
227   for i in $*   for i in $*
# Line 238  generate_icon() Line 243  generate_icon()
243   # some sanity checks :   # some sanity checks :
244    
245   # abort if name or command not given   # abort if name or command not given
246   [ -z "${name}" ] && return 1   [[ -z ${name} ]] && return 1
247   [ -z "${command}" ] && return 1   [[ -z ${command} ]] && return 1
248    
249   # use some defaults for icon, dest, {x,y}res   # use some defaults for icon, dest, {x,y}res
250   [ -z "${xres}" ] && xres=30   [[ -z ${xres} ]] && xres=30
251   [ -z "${yres}" ] && xres=30   [[ -z ${yres} ]] && xres=30
252   [ -z "${dest}" ] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk"   [[ -z ${dest} ]] && dest="${ALX_UNPRIV_HOME}/.xtdesktop/${name}.lnk"
253   if [ -z "${icon}" ] || [ ! -f "${icon}" ]   if [[ -z ${icon} ]] || [ ! -f ${icon} ]
254   then   then
255   # if no default icon is given use default.png   # if no default icon is given use default.png
256   [ -z "${deficon}" ] && deficon="default.png"   [[ -z ${deficon} ]] && deficon="default.png"
257   icon="${ALX_SESSIONS_ICONS}/${deficon}"   icon="${ALX_SESSIONS_ICONS}/${deficon}"
258   fi   fi
259    
260   echo "table Icon" > ${dest}   CONFIG=${dest}
261   echo "  Type: Program" >> ${dest}   clearconfig
262   echo "  Caption: ${name}" >> ${dest}  
263   echo "  Command: ${command}" >> ${dest}   addconfig 'table Icon'
264   echo "  Icon: ${icon}" >> ${dest}   addconfig '  Type: Program'
265   echo "  X: ${xres}" >> ${dest}   addconfig "  Caption: ${name}"
266   echo "  Y: ${yres}" >> ${dest}   addconfig "  Command: ${command}"
267     addconfig "  Icon: ${icon}"
268     addconfig "  X: ${xres}"
269     addconfig "  Y: ${yres}"
270    
271   # add these only if not zero   # add these only if not zero
272   if [ -n "${iwidth}" ] && [ -n "${iheight}" ]   if [[ ! -z ${iwidth} ]] && [[ ! -z ${iheight} ]]
273   then   then
274   echo "  IconWidth: ${iwidth}" >> ${dest}   addconfig "  IconWidth: ${iwidth}"
275   echo "  IconHeight: ${iheight}" >> ${dest}   addconfig "  IconHeight: ${iheight}"
276   fi   fi
277    
278   echo "end" >> ${dest}   addconfig 'end'
279  }  }
280    
281  generate_all_desktop_icons()  generate_all_desktop_icons()
# Line 317  generate_all_desktop_icons() Line 325  generate_all_desktop_icons()
325   for item in ${icon_list}   for item in ${icon_list}
326   do   do
327   # abort if empty   # abort if empty
328   [ -z "${item}" ] && continue   [[ -z ${item} ]] && continue
329    
330   # new line if x > xres   # new line if x > xres
331   if [ ${x} -ge ${xres} ];then   if [ ${x} -ge ${xres} ]
332     then
333   x=30   x=30
334   y=$((${y} + 80))   y=$((${y} + 80))
335   fi   fi
336    
337   # new row if y > yres   # new row if y > yres
338   if [ ${y} -ge ${yres} ];then   if [ ${y} -ge ${yres} ]
339     then
340   x=$((${x} + 120))   x=$((${x} + 120))
341   y=30   y=30
342    
# Line 357  generate_all_desktop_icons() Line 367  generate_all_desktop_icons()
367   for item in ${icon_list}   for item in ${icon_list}
368   do   do
369   # abort if empty   # abort if empty
370   [ -z "${item}" ] && continue   [[ -z ${item} ]] && continue
371    
372   # new line if x > xres   # new line if x > xres
373   if [ ${x} -ge ${xres} ];then   if [ ${x} -ge ${xres} ]
374     then
375   x=30   x=30
376   y=$((${y} + 80))   y=$((${y} + 80))
377   fi   fi
378    
379   # new row if y > yres   # new row if y > yres
380   if [ ${y} -ge ${yres} ];then   if [ ${y} -ge ${yres} ]
381     then
382   x=$((${x} + 120))   x=$((${x} + 120))
383   y=30   y=30
384    
# Line 430  config_sessions() Line 442  config_sessions()
442   local count=${#ALX_SESSIONS[*]}   local count=${#ALX_SESSIONS[*]}
443   local icon   local icon
444   local i   local i
445     local CONFIG
446    
447   # now setup fluxbox for user station   # now setup fluxbox for user station
448    
# Line 447  config_sessions() Line 460  config_sessions()
460   cat ${ALX_SKELETONS}/fluxbox/apps \   cat ${ALX_SKELETONS}/fluxbox/apps \
461   > ${ALX_UNPRIV_HOME}/.fluxbox/apps   > ${ALX_UNPRIV_HOME}/.fluxbox/apps
462    
463     CONFIG=${ALX_UNPRIV_HOME}/.fluxbox/apps
464   # add screensaver   # add screensaver
465   if [[ -n ${ALX_SCRN_SAVER} ]] && [[ -n ${ALX_SCRN_TIMEOUT} ]]   if [[ ! -z ${ALX_SCRN_SAVER} ]] && [[ ! -z ${ALX_SCRN_TIMEOUT} ]]
466   then   then
467   local ALX_PASSWD_CMD   local ALX_PASSWD_CMD
468    
# Line 456  config_sessions() Line 470  config_sessions()
470   then   then
471   ALX_PASSWD_CMD="-nolock"   ALX_PASSWD_CMD="-nolock"
472   else   else
473   ALX_PASSWD_CMD="-cpasswd $(openssl passwd ${ALX_SCRN_PASSWD})"   ALX_PASSWD_CMD="-cpasswd $(cryptpw -m des ${ALX_SCRN_PASSWD})"
474   fi   fi
475    
476   echo "[startup] {nohup xautolock -time ${ALX_SCRN_TIMEOUT} -locker 'xlock -mode ${ALX_SCRN_SAVER} ${ALX_PASSWD_CMD}' > /dev/null &}" \   addconfig "[startup] {nohup xautolock -time ${ALX_SCRN_TIMEOUT} -locker 'xlock -mode ${ALX_SCRN_SAVER} ${ALX_PASSWD_CMD}' > /dev/null &}"
  >> ${ALX_UNPRIV_HOME}/.fluxbox/apps  
477   fi   fi
478    
479   # add autostart session   # add autostart session
480   if [[ ${ALX_AUTOSTART} != "" ]]   if [[ ! -z ${ALX_AUTOSTART} ]]
481   then   then
482   echo "[startup] {nohup nice -n 19 wfica ${ALX_ICA_SESSIONS}/${ALX_AUTOSTART} &}" \   addconfig "[startup] {nohup nice -n 19 wfica ${ALX_ICA_SESSIONS}/${ALX_AUTOSTART} &}"
  >> ${ALX_UNPRIV_HOME}/.fluxbox/apps  
483   fi   fi
484    
485   # fluxbox hotkeys   # fluxbox hotkeys
486   cat ${ALX_SKELETONS}/fluxbox/keys \   cat ${ALX_SKELETONS}/fluxbox/keys > ${ALX_UNPRIV_HOME}/.fluxbox/keys
487   > ${ALX_UNPRIV_HOME}/.fluxbox/keys  
488     # generate a fluxbox menu
489     CONFIG=${ALX_UNPRIV_HOME}/.fluxbox/menu
490     clearconfig
491    
492   # fluxbox menu header   # fluxbox menu header
493   cat ${ALX_SKELETONS}/fluxbox/menu.header \   cat ${ALX_SKELETONS}/fluxbox/menu.header >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
  > ${ALX_UNPRIV_HOME}/.fluxbox/menu  
494    
495   # now fix it with proper messages :P   # now fix it with proper messages :P
496   local ver="$(< /etc/mageversion)"   local ver="$(< /etc/mageversion)"
497   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  
498    
499   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
500   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig
501    
502   # fluxbox menu sessions   # fluxbox menu sessions
503   for (( i=0; i < count; i++ ))   for (( i=0; i < count; i++ ))
504   do   do
505   [ -n "${ALX_SESSIONS[${i}]}" ] && \   if [[ ! -z ${ALX_SESSIONS[${i}]} ]]
506   echo "[exec] ($(basename ${ALX_SESSIONS[${i}]} .ica)) {nice -n 19 wfica ${ALX_ICA_SESSIONS}/${ALX_SESSIONS[${i}]}}" \   then
507   >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig "[exec] ($(basename ${ALX_SESSIONS[${i}]} .ica)) {nice -n 19 wfica ${ALX_ICA_SESSIONS}/${ALX_SESSIONS[${i}]}}"
508     fi
509   done   done
510    
511   # add other menuitems   # add other menuitems
512   get_other_menuitems >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig $(get_other_menuitems)
513    
514   # fluxbox menu footer   # fluxbox menu footer
515   cat ${ALX_SKELETONS}/fluxbox/menu.footer \   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
  >> ${ALX_UNPRIV_HOME}/.fluxbox/menu  
516    
517   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
518   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig
519    
520   # now it's a good time to generate *all* icons :)   # now it's a good time to generate *all* icons :)
521   generate_all_desktop_icons   generate_all_desktop_icons
# Line 521  config_sessions() Line 534  config_sessions()
534   unset ALX_SCRN_TIMEOUT   unset ALX_SCRN_TIMEOUT
535   unset ALX_SCRN_PASSWD   unset ALX_SCRN_PASSWD
536  }  }
   

Legend:
Removed from v.2001  
changed lines
  Added in v.2035