Annotation of /alx-src/trunk/tinyalxconfig-ng/functions/config_modules.sh
Parent Directory | Revision Log
Revision 393 -
(hide annotations)
(download)
(as text)
Wed Jun 4 18:12:29 2008 UTC (15 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1923 byte(s)
Wed Jun 4 18:12:29 2008 UTC (15 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1923 byte(s)
-using /etc/modules.autoload as modfile and some style updates
1 | niro | 393 | # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_modules.sh,v 1.2 2008-06-04 18:12:29 niro Exp $ |
2 | niro | 386 | # 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 | niro | 393 | local modfile="/etc/modules.autoload" |
38 | niro | 386 | local mod |
39 | |||
40 | for mod in ${modules} | ||
41 | do | ||
42 | niro | 393 | [[ -n $(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*) ]] && \ |
43 | niro | 386 | 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 | niro | 393 | modfile="/etc/modules.autoload" |
57 | niro | 386 | |
58 | # clear the old one | ||
59 | :> ${modfile} | ||
60 | |||
61 | # needed for printing: | ||
62 | add_modules lp parport parport_pc | ||
63 | |||
64 | niro | 393 | [[ -n ${ALX_NETWORK_MODULE} ]] && \ |
65 | niro | 386 | echo "${ALX_NETWORK_MODULE}" >> ${modfile} |
66 | |||
67 | # intel i810 needs intel-agp module to work probably | ||
68 | [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp | ||
69 | |||
70 | for ((i=0; i <= ALX_COUNT; i++)) | ||
71 | do | ||
72 | niro | 393 | [[ -n ${ALX_MODULES[${i}]} ]] && \ |
73 | niro | 386 | echo "${ALX_MODULES[${i}]}" >> ${modfile} |
74 | done | ||
75 | |||
76 | unset ALX_COUNT | ||
77 | unset ALX_MODULES | ||
78 | unset ALX_NETWORK_MODULE | ||
79 | unset ALX_GFX_MODULE | ||
80 | } |