Magellan Linux

Diff of /alx-src/trunk/alxconfig-ng/init.d/alxsettings

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

revision 247 by niro, Tue Apr 12 20:46:52 2005 UTC revision 248 by niro, Wed Apr 13 16:15:28 2005 UTC
# Line 11  Line 11 
11  #%before:  #%before:
12  #%after:  #%after:
13    
14  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.7 2005-04-12 20:45:55 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.8 2005-04-13 16:15:28 niro Exp $
15    
16  # checks first if the client was already configured and if it has an valid serial  # checks first if the client was already configured and if it has an valid serial
17  # if not it runs the autoconfiguration script  # if not it runs the autoconfiguration script
# Line 32  source /usr/lib/alxconfig-ng/functions/c Line 32  source /usr/lib/alxconfig-ng/functions/c
32  source /usr/lib/alxconfig-ng/functions/config_printers  source /usr/lib/alxconfig-ng/functions/config_printers
33  source /usr/lib/alxconfig-ng/functions/config_sessions  source /usr/lib/alxconfig-ng/functions/config_sessions
34  source /usr/lib/alxconfig-ng/functions/config_x11  source /usr/lib/alxconfig-ng/functions/config_x11
35    source /usr/lib/alxconfig-ng/functions/config_auth
36    
37  #check if mysql is available  #check if mysql is available
38  [ -x /usr/bin/mysql ] && MYSQL_ALX=true  [ -x /usr/bin/mysql ] && MYSQL_ALX=true
# Line 47  unset ALX_SERIAL ALX_STATE Line 48  unset ALX_SERIAL ALX_STATE
48  [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state  [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state
49    
50    
 validate_sessions(){  
   
  local x i all LOCAL_SESSIONS DB_SESSIONS SETTINGSPATH count  
   
  #all arrays:  
  # ->  session1 session2 ... sessionN  
   
   
  #no LOCAL_SESSIONS here, needs bubblesort  
   
  #get settings from database  
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select session 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  
  DB_SESSIONS[${i}]=${x}  
  ((i++))  
  done  
  count=${i}  
  else  
  count=0  
  fi  
   
  ## no compare here, can only done with bubblesort or s.th like that  
  # shows only the new sessions  
  declare -i i=0  
  #count=${#DB_SESSIONS[*]} #---> not working gets always 1, why ?  
   
  echo "Number of new sessions: ${count}"  
  for ((i=0; i < count; i++))  
  do  
  echo "${i} - ${DB_SESSIONS[${i}]}"  
  done  
   
  #update local configs  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
  declare -i i=0  
   
  #count=${#DB_SESSIONS[*]}  
   
  if [ ${count} -gt 0 ]  
  then  
  #create directory if not exist  
  [ ! -d ${SETTINGSPATH}/sessions ] && install -d ${SETTINGSPATH}/sessions  
   
  #delete old sessions  
  echo -n > ${SETTINGSPATH}/sessions/sessions  
   
  for ((i=0; i < count; i++))  
  do  
  echo "${DB_SESSIONS[${i}]}" >> ${SETTINGSPATH}/sessions/sessions  
  done  
   
  #set update flag  
  ALX_SESSION_SETUP=true  
  fi  
 }  
   
   
51  update_system_settings(){  update_system_settings(){
52   echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT}   echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT}
53    
# Line 120  update_system_settings(){ Line 57  update_system_settings(){
57   # imports x11 settings from db   # imports x11 settings from db
58   config_x11   config_x11
59    
60   #echo   # imports session settings from db
  #echo "sessions"  
  #validate_sessions  
  #echo  
61   config_sessions   config_sessions
62    
63   # imports printer settings from db   # imports printer settings from db
64   config_printing   config_printing
65    
66     # imports auth settings from db
67     config_auth
68  }  }
69    
70  get_system_serial(){  get_system_serial(){

Legend:
Removed from v.247  
changed lines
  Added in v.248