Magellan Linux

Annotation of /alx-src/trunk/alxconfig-ng/functions/config_modules.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 332 - (hide annotations) (download) (as text)
Wed Sep 14 21:08:34 2005 UTC (18 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 2265 byte(s)
- loading now lp, parport, parport_pc forcefully, some pcs with non fully acpi compilant bioses doesn't detect them right

1 niro 332 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.4 2005-09-14 21:08:34 niro Exp $
2 niro 256 # configures printing on the host via mysql db settings
3     # Note must be the first configure script which will be startet
4    
5     kernel_major_version()
6     {
7     local KV
8 niro 332 KV="$(uname -r | cut -d. -f1-2)"
9 niro 256 echo "${KV}"
10     }
11    
12     get_modules_settings()
13     {
14     local i count mod_ids settings
15    
16     # first get all module names
17     mod_ids=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
18     "select id from cfg_modules where serial='${ALX_SERIAL}'")
19    
20     # set counter equal to numbers of printers
21     declare -i count=0
22     for i in ${mod_ids}
23     do
24     # now get the other settings und put them in arrays
25     ALX_MODULES[${count}]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
26     "select module from cfg_modules where id=${i};")
27    
28     (( count++ ))
29     done
30    
31     # get network module
32     ALX_NETWORK_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
33     "select module from cfg_network where serial=${ALX_SERIAL};")
34    
35 niro 318 ## fixes needed to satisfy some deps
36     ALX_GFX_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
37 niro 322 "select module from cfg_graphic where serial=${ALX_SERIAL};")
38 niro 318
39 niro 256 # export all settings
40     export ALX_COUNT=${count}
41     export ALX_NETWORK_MODULE
42 niro 318 export ALX_GFX_MODULE
43 niro 256 export ALX_MODULES
44     }
45    
46 niro 332 add_modules()
47     {
48     local modules="$@"
49     local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
50     local mod
51    
52     for mod in ${modules}
53     do
54     [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ] && \
55     echo "${mod}" >> ${modfile}
56     done
57     }
58    
59 niro 256 config_modules()
60     {
61     local i
62 niro 318 local modfile
63 niro 256
64     #first of all get the vars
65     get_modules_settings
66    
67 niro 318 # location of the modules.autoload file
68     modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
69    
70 niro 332 # needed for printing:
71     add_modules lp parport parport_pc
72    
73 niro 256 [ -n "${ALX_NETWORK_MODULE}" ] && \
74 niro 318 echo "${ALX_NETWORK_MODULE}" >> ${modfile}
75 niro 256
76 niro 318 # intel i810 needs intel-agp module to work probably
77 niro 332 [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp
78 niro 318
79 niro 256 for ((i=0; i <= ALX_COUNT; i++))
80     do
81     [ -n "${ALX_MODULES[${i}]}" ] && \
82 niro 318 echo "${ALX_MODULES[${i}]}" >> ${modfile}
83 niro 256 done
84    
85     unset ALX_COUNT
86     unset ALX_MODULES
87     unset ALX_NETWORK_MODULE
88 niro 318 unset ALX_GFX_MODULE
89 niro 256 }