Annotation of /alx-src/tags/alxconf-0_6_0-rc8/functions/config_modules.sh
Parent Directory | Revision Log
Revision 2013 -
(hide annotations)
(download)
(as text)
Mon May 9 15:57:20 2011 UTC (13 years, 4 months ago) by niro
Original Path: alx-src/branches/alxconf-060/functions/config_modules.sh
File MIME type: application/x-sh
File size: 2773 byte(s)
Mon May 9 15:57:20 2011 UTC (13 years, 4 months ago) by niro
Original Path: alx-src/branches/alxconf-060/functions/config_modules.sh
File MIME type: application/x-sh
File size: 2773 byte(s)
-no splitted modules.autoload files anymore
1 | niro | 1971 | # $Id$ |
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 | get_modules_settings() | ||
6 | { | ||
7 | niro | 1721 | local i count mod_ids settings arg |
8 | niro | 256 | |
9 | # first get all module names | ||
10 | niro | 342 | mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'") |
11 | niro | 256 | |
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 | niro | 342 | ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};") |
18 | niro | 1721 | # get modules arguments |
19 | arg=$(mysqldo "select arg from cfg_modules where id=${i};") | ||
20 | # handle Nulls | ||
21 | [[ ${arg} = NULL ]] && arg="" | ||
22 | ALX_MODULES_ARG[${count}]="${arg}" | ||
23 | niro | 256 | (( count++ )) |
24 | done | ||
25 | |||
26 | # get network module | ||
27 | niro | 342 | ALX_NETWORK_MODULE=$(mysqldo "select module from cfg_network where serial=${ALX_SERIAL};") |
28 | niro | 256 | |
29 | niro | 318 | ## fixes needed to satisfy some deps |
30 | niro | 342 | ALX_GFX_MODULE=$(mysqldo "select module from cfg_graphic where serial=${ALX_SERIAL};") |
31 | niro | 318 | |
32 | niro | 256 | # export all settings |
33 | export ALX_COUNT=${count} | ||
34 | export ALX_NETWORK_MODULE | ||
35 | niro | 318 | export ALX_GFX_MODULE |
36 | niro | 256 | export ALX_MODULES |
37 | niro | 1721 | export ALX_MODULES_ARG |
38 | niro | 256 | } |
39 | |||
40 | niro | 332 | add_modules() |
41 | { | ||
42 | local modules="$@" | ||
43 | niro | 2013 | local modfile="/etc/modules.autoload" |
44 | niro | 1721 | local argfile="${SETTINGSPATH}/modules-args" |
45 | niro | 332 | local mod |
46 | niro | 1721 | local arg |
47 | local oldifs | ||
48 | niro | 332 | |
49 | for mod in ${modules} | ||
50 | do | ||
51 | niro | 1646 | if [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ] |
52 | then | ||
53 | niro | 1721 | # get the args |
54 | arg="$(grep ^${mod}: ${argfile})" | ||
55 | |||
56 | # extract the arguments | ||
57 | if [[ -n ${arg} ]] | ||
58 | then | ||
59 | arg="${arg##*:}" | ||
60 | echo "${mod} ${arg}" >> ${modfile} | ||
61 | else | ||
62 | echo "${mod}" >> ${modfile} | ||
63 | fi | ||
64 | niro | 1646 | fi |
65 | niro | 332 | done |
66 | } | ||
67 | |||
68 | niro | 1721 | create_argfile() |
69 | { | ||
70 | local argfile="${SETTINGSPATH}/modules-args" | ||
71 | local count="${#ALX_MODULES[*]}" | ||
72 | local i | ||
73 | |||
74 | for ((i=0; i<count; i++)) | ||
75 | do | ||
76 | if [[ ! -z ${ALX_MODULES_ARG[${i}]} ]] | ||
77 | then | ||
78 | echo "${ALX_MODULES[${i}]}:${ALX_MODULES_ARG[${i}]}" >> ${argfile} | ||
79 | fi | ||
80 | done | ||
81 | } | ||
82 | |||
83 | niro | 256 | config_modules() |
84 | { | ||
85 | local i | ||
86 | niro | 318 | local modfile |
87 | niro | 1721 | local argfile |
88 | niro | 256 | |
89 | niro | 342 | # first of all get the vars |
90 | niro | 256 | get_modules_settings |
91 | |||
92 | niro | 318 | # location of the modules.autoload file |
93 | niro | 2013 | modfile="/etc/modules.autoload" |
94 | niro | 1721 | # location of the modules argument file |
95 | argfile="${SETTINGSPATH}/modules-args" | ||
96 | niro | 318 | |
97 | niro | 334 | # clear the old one |
98 | :> ${modfile} | ||
99 | niro | 1721 | :> ${argfile} |
100 | niro | 334 | |
101 | niro | 1721 | # create a new arg file |
102 | create_argfile | ||
103 | |||
104 | niro | 332 | # needed for printing: |
105 | niro | 547 | add_modules lp parport parport_pc usblp |
106 | niro | 332 | |
107 | niro | 1646 | if [[ -n ${ALX_NETWORK_MODULE} ]] |
108 | then | ||
109 | add_modules "${ALX_NETWORK_MODULE}" | ||
110 | fi | ||
111 | niro | 256 | |
112 | niro | 318 | # intel i810 needs intel-agp module to work probably |
113 | niro | 332 | [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp |
114 | niro | 1615 | [[ ${ALX_GFX_MODULE} = intel ]] && add_modules intel-agp |
115 | niro | 318 | |
116 | niro | 256 | for ((i=0; i <= ALX_COUNT; i++)) |
117 | niro | 1646 | do |
118 | if [[ -n ${ALX_MODULES[${i}]} ]] | ||
119 | then | ||
120 | add_modules "${ALX_MODULES[${i}]}" | ||
121 | fi | ||
122 | niro | 256 | done |
123 | |||
124 | unset ALX_COUNT | ||
125 | unset ALX_MODULES | ||
126 | unset ALX_NETWORK_MODULE | ||
127 | niro | 318 | unset ALX_GFX_MODULE |
128 | niro | 256 | } |