Magellan Linux

Diff of /alx-src/tags/alxconf-0_6_4_5/functions/config_modules.sh

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

alx-src/trunk/alxconfig-ng/functions/config_modules.sh revision 318 by niro, Thu Sep 1 18:29:56 2005 UTC alx-src/branches/alxconf-060/functions/config_modules.sh revision 2146 by niro, Tue May 17 11:45:29 2011 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.2 2005-09-01 18:29:56 niro Exp $  # $Id$
2  # configures printing on the host via mysql db settings  # configures printing on the host via mysql db settings
3  # Note must be the first configure script which will be startet  # Note must be the first configure script which will be startet
4    
5  kernel_major_version()  add_module()
6  {  {
7   local KV   local module="$1"
8   KV="$(uname -r|cut -d. -f1-2)"   local arg="$2"
  echo "${KV}"  
 }  
   
 get_modules_settings()  
 {  
  local i count mod_ids settings  
   
  # first get all module names  
  mod_ids=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select id from cfg_modules where serial='${ALX_SERIAL}'")  
   
  # set counter equal to numbers of printers  
  declare -i count=0  
  for i in ${mod_ids}  
  do  
  # now get the other settings und put them in arrays  
  ALX_MODULES[${count}]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select module from cfg_modules where id=${i};")  
9    
10   (( count++ ))   if [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ]
11     then
12     if [[ -z ${arg} ]]
13     then
14     addconfig "${module}"
15     else
16     addconfig "${mod} ${arg}"
17     fi
18   done   done
   
  # get network module  
  ALX_NETWORK_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select module from cfg_network where serial=${ALX_SERIAL};")  
   
  ## fixes needed to satisfy some deps  
  ALX_GFX_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select module from cfg_grafic where serial=${ALX_SERIAL};")  
   
  # export all settings  
  export ALX_COUNT=${count}  
  export ALX_NETWORK_MODULE  
  export ALX_GFX_MODULE  
  export ALX_MODULES  
19  }  }
20    
21  config_modules()  config_modules()
22  {  {
23     local all_ids
24   local i   local i
25   local modfile   local CONFIG
26    
27   #first of all get the vars   # first of all ids
28   get_modules_settings   all_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'")
29    
30     # get network module
31     evaluate_table cfg_network
32    
33     # get graphic module
34     evaluate_table cfg_graphic
35    
36   # location of the modules.autoload file   # location of the modules.autoload file
37   modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"   CONFIG="/etc/modules.autoload"
38    
39     # clear the old one
40     clearconfig
41    
42   # write default settings:   # needed for printing:
43   echo "lp" > ${modfile}   add_module lp
44   [ -n "${ALX_NETWORK_MODULE}" ] && \   add_module parport
45   echo "${ALX_NETWORK_MODULE}" >> ${modfile}   add_module parport_pc
46     add_module usblp
47    
48     if [[ -n ${cfg_network_module} ]]
49     then
50     add_module "${cfg_network_module}"
51     fi
52    
53   # intel i810 needs intel-agp module to work probably   # intel i810 needs intel-agp module to work probably
54   [[ ${ALX_GFX_MODULE} = i810 ]] && \   case ${cfg_graphic_module} in
55   [ -f /lib/modules/$(uname -r)/kernel/drivers/char/agp/intel-agp.ko ] && \   i810) add_module intel-agp ;;
56   echo "intel-agp" >> ${modfile}   intel) add_module intel-agp ;;
57     esac
  for ((i=0; i <= ALX_COUNT; i++))  
  do  
  [ -n "${ALX_MODULES[${i}]}" ] && \  
  echo "${ALX_MODULES[${i}]}" >> ${modfile}  
  done  
58    
59   unset ALX_COUNT   for i in ${all_ids}
60   unset ALX_MODULES   do
61   unset ALX_NETWORK_MODULE   evaluate_table cfg_modules "where serial='${ALX_SERIAL}' and id='${i}'"
62   unset ALX_GFX_MODULE   if [[ -n ${cfg_modules_module} ]]
63     then
64     add_module "${cfg_modules_module}" "${cfg_modules_arg}"
65     fi
66     done
67  }  }

Legend:
Removed from v.318  
changed lines
  Added in v.2146