Magellan Linux

Contents of /alx-src/trunk/tinyalxconfig-ng/functions/config_modules.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 436 - (show annotations) (download) (as text)
Wed Jun 4 23:39:01 2008 UTC (15 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1955 byte(s)
-only add network module of not 'auto'
-make use of add_modules

1 # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_modules.sh,v 1.3 2008-06-04 23:39:01 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 get_modules_settings()
6 {
7 local i count mod_ids settings
8
9 # first get all module names
10 mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'")
11
12 # set counter equal to numbers of printers
13 declare -i count=0
14 for i in ${mod_ids}
15 do
16 # now get the other settings und put them in arrays
17 ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};")
18 (( count++ ))
19 done
20
21 # get network module
22 ALX_NETWORK_MODULE=$(mysqldo "select module from cfg_network where serial=${ALX_SERIAL};")
23
24 ## fixes needed to satisfy some deps
25 ALX_GFX_MODULE=$(mysqldo "select module from cfg_graphic where serial=${ALX_SERIAL};")
26
27 # export all settings
28 export ALX_COUNT=${count}
29 export ALX_NETWORK_MODULE
30 export ALX_GFX_MODULE
31 export ALX_MODULES
32 }
33
34 add_modules()
35 {
36 local modules="$@"
37 local modfile="/etc/modules.autoload"
38 local mod
39
40 for mod in ${modules}
41 do
42 [[ -n $(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*) ]] && \
43 echo "${mod}" >> ${modfile}
44 done
45 }
46
47 config_modules()
48 {
49 local i
50 local modfile
51
52 # first of all get the vars
53 get_modules_settings
54
55 # location of the modules.autoload file
56 modfile="/etc/modules.autoload"
57
58 # clear the old one
59 :> ${modfile}
60
61 # needed for printing:
62 add_modules lp parport parport_pc
63
64 if [[ -n ${ALX_NETWORK_MODULE} ]] && [[ ${ALX_NETWORK_MODULE} != auto ]]
65 then
66 add_modules "${ALX_NETWORK_MODULE}"
67 fi
68
69 # intel i810 needs intel-agp module to work probably
70 [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp
71
72 for ((i=0; i <= ALX_COUNT; i++))
73 do
74 [[ -n ${ALX_MODULES[${i}]} ]] && \
75 add_modules "${ALX_MODULES[${i}]}"
76 done
77
78 unset ALX_COUNT
79 unset ALX_MODULES
80 unset ALX_NETWORK_MODULE
81 unset ALX_GFX_MODULE
82 }