Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 334 - (show 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 # $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 # 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 KV="$(uname -r | cut -d. -f1-2)"
9 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 ## fixes needed to satisfy some deps
36 ALX_GFX_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
37 "select module from cfg_graphic where serial=${ALX_SERIAL};")
38
39 # export all settings
40 export ALX_COUNT=${count}
41 export ALX_NETWORK_MODULE
42 export ALX_GFX_MODULE
43 export ALX_MODULES
44 }
45
46 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 config_modules()
60 {
61 local i
62 local modfile
63
64 #first of all get the vars
65 get_modules_settings
66
67 # location of the modules.autoload file
68 modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
69
70 # clear the old one
71 :> ${modfile}
72
73 # needed for printing:
74 add_modules lp parport parport_pc
75
76 [ -n "${ALX_NETWORK_MODULE}" ] && \
77 echo "${ALX_NETWORK_MODULE}" >> ${modfile}
78
79 # intel i810 needs intel-agp module to work probably
80 [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp
81
82 for ((i=0; i <= ALX_COUNT; i++))
83 do
84 [ -n "${ALX_MODULES[${i}]}" ] && \
85 echo "${ALX_MODULES[${i}]}" >> ${modfile}
86 done
87
88 unset ALX_COUNT
89 unset ALX_MODULES
90 unset ALX_NETWORK_MODULE
91 unset ALX_GFX_MODULE
92 }