Magellan Linux

Annotation of /alx-src/branches/alxconf-060/functions/config_modules.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 334 - (hide annotations) (download) (as text)
Sun Sep 18 19:18:55 2005 UTC (18 years, 8 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_modules.sh
File MIME type: application/x-sh
File size: 2302 byte(s)
now clearing the ${modfile} again

1 niro 334 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.5 2005-09-18 19:18:55 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 334 # clear the old one
71     :> ${modfile}
72    
73 niro 332 # needed for printing:
74     add_modules lp parport parport_pc
75    
76 niro 256 [ -n "${ALX_NETWORK_MODULE}" ] && \
77 niro 318 echo "${ALX_NETWORK_MODULE}" >> ${modfile}
78 niro 256
79 niro 318 # intel i810 needs intel-agp module to work probably
80 niro 332 [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp
81 niro 318
82 niro 256 for ((i=0; i <= ALX_COUNT; i++))
83     do
84     [ -n "${ALX_MODULES[${i}]}" ] && \
85 niro 318 echo "${ALX_MODULES[${i}]}" >> ${modfile}
86 niro 256 done
87    
88     unset ALX_COUNT
89     unset ALX_MODULES
90     unset ALX_NETWORK_MODULE
91 niro 318 unset ALX_GFX_MODULE
92 niro 256 }