Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 256 - (show annotations) (download) (as text)
Thu Apr 14 21:24:31 2005 UTC (19 years ago) by niro
File MIME type: application/x-sh
File size: 1666 byte(s)
new; configures kernel modules

1 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.1 2005-04-14 21:24:31 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 # export all settings
36 export ALX_COUNT=${count}
37 export ALX_NETWORK_MODULE
38 export ALX_MODULES
39 }
40
41 config_modules()
42 {
43 local i
44
45 #first of all get the vars
46 get_modules_settings
47
48 # write default settings:
49 echo "lp" > /etc/modules.autoload.d/kernel-$(kernel_major_version)
50 [ -n "${ALX_NETWORK_MODULE}" ] && \
51 echo "${ALX_NETWORK_MODULE}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
52
53 for ((i=0; i <= ALX_COUNT; i++))
54 do
55 [ -n "${ALX_MODULES[${i}]}" ] && \
56 echo "${ALX_MODULES[${i}]}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
57
58 done
59
60 unset ALX_COUNT
61 unset ALX_MODULES
62 unset ALX_NETWORK_MODULE
63 }