Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 318 - (show annotations) (download) (as text)
Thu Sep 1 18:29:56 2005 UTC (18 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 2086 byte(s)
added a fix for i810 gfx cards (needs intel-agp if this was compiled as module)

1 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.2 2005-09-01 18:29:56 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 ## fixes needed to satisfy some deps
36 ALX_GFX_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
37 "select module from cfg_grafic where serial=${ALX_SERIAL};")
38
39 # export all settings
40 export ALX_COUNT=${count}
41 export ALX_NETWORK_MODULE
42 export ALX_GFX_MODULE
43 export ALX_MODULES
44 }
45
46 config_modules()
47 {
48 local i
49 local modfile
50
51 #first of all get the vars
52 get_modules_settings
53
54 # location of the modules.autoload file
55 modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
56
57 # write default settings:
58 echo "lp" > ${modfile}
59 [ -n "${ALX_NETWORK_MODULE}" ] && \
60 echo "${ALX_NETWORK_MODULE}" >> ${modfile}
61
62 # intel i810 needs intel-agp module to work probably
63 [[ ${ALX_GFX_MODULE} = i810 ]] && \
64 [ -f /lib/modules/$(uname -r)/kernel/drivers/char/agp/intel-agp.ko ] && \
65 echo "intel-agp" >> ${modfile}
66
67 for ((i=0; i <= ALX_COUNT; i++))
68 do
69 [ -n "${ALX_MODULES[${i}]}" ] && \
70 echo "${ALX_MODULES[${i}]}" >> ${modfile}
71 done
72
73 unset ALX_COUNT
74 unset ALX_MODULES
75 unset ALX_NETWORK_MODULE
76 unset ALX_GFX_MODULE
77 }