Magellan Linux

Diff of /alx-src/branches/alxconf_20060908/functions/config_modules.sh

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

revision 1720 by niro, Thu Dec 30 13:42:28 2010 UTC revision 1721 by niro, Thu Feb 17 16:23:41 2011 UTC
# Line 11  kernel_major_version() Line 11  kernel_major_version()
11    
12  get_modules_settings()  get_modules_settings()
13  {  {
14   local i count mod_ids settings   local i count mod_ids settings arg
15    
16   # first get all module names   # first get all module names
17   mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'")   mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'")
# Line 22  get_modules_settings() Line 22  get_modules_settings()
22   do   do
23   # now get the other settings und put them in arrays   # now get the other settings und put them in arrays
24   ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};")   ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};")
25     # get modules arguments
26     arg=$(mysqldo "select arg from cfg_modules where id=${i};")
27     # handle Nulls
28     [[ ${arg} = NULL ]] && arg=""
29     ALX_MODULES_ARG[${count}]="${arg}"
30   (( count++ ))   (( count++ ))
31   done   done
32    
# Line 36  get_modules_settings() Line 41  get_modules_settings()
41   export ALX_NETWORK_MODULE   export ALX_NETWORK_MODULE
42   export ALX_GFX_MODULE   export ALX_GFX_MODULE
43   export ALX_MODULES   export ALX_MODULES
44     export ALX_MODULES_ARG
45  }  }
46    
47  add_modules()  add_modules()
48  {  {
49   local modules="$@"   local modules="$@"
50   local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"   local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
51     local argfile="${SETTINGSPATH}/modules-args"
52   local mod   local mod
53     local arg
54     local oldifs
55    
56   for mod in ${modules}   for mod in ${modules}
57   do   do
58   if [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ]   if [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ]
59   then   then
60   echo "${mod}" >> ${modfile}   # get the args
61     arg="$(grep ^${mod}: ${argfile})"
62    
63     # extract the arguments
64     if [[ -n ${arg} ]]
65     then
66     arg="${arg##*:}"
67     echo "${mod} ${arg}" >> ${modfile}
68     else
69     echo "${mod}" >> ${modfile}
70     fi
71     fi
72     done
73    }
74    
75    create_argfile()
76    {
77     local argfile="${SETTINGSPATH}/modules-args"
78     local count="${#ALX_MODULES[*]}"
79     local i
80    
81     for ((i=0; i<count; i++))
82     do
83     if [[ ! -z ${ALX_MODULES_ARG[${i}]} ]]
84     then
85     echo "${ALX_MODULES[${i}]}:${ALX_MODULES_ARG[${i}]}" >> ${argfile}
86   fi   fi
87   done   done
88  }  }
# Line 57  config_modules() Line 91  config_modules()
91  {  {
92   local i   local i
93   local modfile   local modfile
94     local argfile
95    
96   # first of all get the vars   # first of all get the vars
97   get_modules_settings   get_modules_settings
98    
99   # location of the modules.autoload file   # location of the modules.autoload file
100   modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"   modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
101     # location of the modules argument file
102     argfile="${SETTINGSPATH}/modules-args"
103    
104   # clear the old one   # clear the old one
105   :> ${modfile}   :> ${modfile}
106     :> ${argfile}
107    
108     # create a new arg file
109     create_argfile
110    
111   # needed for printing:   # needed for printing:
112   add_modules lp parport parport_pc usblp   add_modules lp parport parport_pc usblp
113    

Legend:
Removed from v.1720  
changed lines
  Added in v.1721