Annotation of /alx-src/branches/alxconf-060/functions/config_modules.sh
Parent Directory | Revision Log
Revision 1646 -
(hide annotations)
(download)
(as text)
Thu Dec 30 13:42:28 2010 UTC (13 years, 9 months ago) by niro
Original Path: alx-src/branches/alxconf_20060908/functions/config_modules.sh
File MIME type: application/x-sh
File size: 2147 byte(s)
Thu Dec 30 13:42:28 2010 UTC (13 years, 9 months ago) by niro
Original Path: alx-src/branches/alxconf_20060908/functions/config_modules.sh
File MIME type: application/x-sh
File size: 2147 byte(s)
-only add modules to autoload if they really exist (may be included in the kernel image)
1 | niro | 342 | # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.6 2005-10-09 21:28:46 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 | niro | 342 | mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'") |
18 | niro | 256 | |
19 | # set counter equal to numbers of printers | ||
20 | declare -i count=0 | ||
21 | for i in ${mod_ids} | ||
22 | do | ||
23 | # now get the other settings und put them in arrays | ||
24 | niro | 342 | ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};") |
25 | niro | 256 | (( count++ )) |
26 | done | ||
27 | |||
28 | # get network module | ||
29 | niro | 342 | ALX_NETWORK_MODULE=$(mysqldo "select module from cfg_network where serial=${ALX_SERIAL};") |
30 | niro | 256 | |
31 | niro | 318 | ## fixes needed to satisfy some deps |
32 | niro | 342 | ALX_GFX_MODULE=$(mysqldo "select module from cfg_graphic where serial=${ALX_SERIAL};") |
33 | niro | 318 | |
34 | niro | 256 | # export all settings |
35 | export ALX_COUNT=${count} | ||
36 | export ALX_NETWORK_MODULE | ||
37 | niro | 318 | export ALX_GFX_MODULE |
38 | niro | 256 | export ALX_MODULES |
39 | } | ||
40 | |||
41 | niro | 332 | add_modules() |
42 | { | ||
43 | local modules="$@" | ||
44 | local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" | ||
45 | local mod | ||
46 | |||
47 | for mod in ${modules} | ||
48 | do | ||
49 | niro | 1646 | if [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ] |
50 | then | ||
51 | niro | 332 | echo "${mod}" >> ${modfile} |
52 | niro | 1646 | fi |
53 | niro | 332 | done |
54 | } | ||
55 | |||
56 | niro | 256 | config_modules() |
57 | { | ||
58 | local i | ||
59 | niro | 318 | local modfile |
60 | niro | 256 | |
61 | niro | 342 | # first of all get the vars |
62 | niro | 256 | get_modules_settings |
63 | |||
64 | niro | 318 | # location of the modules.autoload file |
65 | modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" | ||
66 | |||
67 | niro | 334 | # clear the old one |
68 | :> ${modfile} | ||
69 | |||
70 | niro | 332 | # needed for printing: |
71 | niro | 547 | add_modules lp parport parport_pc usblp |
72 | niro | 332 | |
73 | niro | 1646 | if [[ -n ${ALX_NETWORK_MODULE} ]] |
74 | then | ||
75 | add_modules "${ALX_NETWORK_MODULE}" | ||
76 | fi | ||
77 | niro | 256 | |
78 | niro | 318 | # intel i810 needs intel-agp module to work probably |
79 | niro | 332 | [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp |
80 | niro | 1615 | [[ ${ALX_GFX_MODULE} = intel ]] && add_modules intel-agp |
81 | niro | 318 | |
82 | niro | 256 | for ((i=0; i <= ALX_COUNT; i++)) |
83 | niro | 1646 | do |
84 | if [[ -n ${ALX_MODULES[${i}]} ]] | ||
85 | then | ||
86 | add_modules "${ALX_MODULES[${i}]}" | ||
87 | fi | ||
88 | niro | 256 | done |
89 | |||
90 | unset ALX_COUNT | ||
91 | unset ALX_MODULES | ||
92 | unset ALX_NETWORK_MODULE | ||
93 | niro | 318 | unset ALX_GFX_MODULE |
94 | niro | 256 | } |