Magellan Linux

Annotation of /alx-src/branches/alxconf_20060908/functions/config_modules.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 318 - (hide annotations) (download) (as text)
Thu Sep 1 18:29:56 2005 UTC (18 years, 8 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_modules.sh
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 niro 318 # $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 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     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 niro 318 ## 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 niro 256 # export all settings
40     export ALX_COUNT=${count}
41     export ALX_NETWORK_MODULE
42 niro 318 export ALX_GFX_MODULE
43 niro 256 export ALX_MODULES
44     }
45    
46     config_modules()
47     {
48     local i
49 niro 318 local modfile
50 niro 256
51     #first of all get the vars
52     get_modules_settings
53    
54 niro 318 # location of the modules.autoload file
55     modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)"
56    
57 niro 256 # write default settings:
58 niro 318 echo "lp" > ${modfile}
59 niro 256 [ -n "${ALX_NETWORK_MODULE}" ] && \
60 niro 318 echo "${ALX_NETWORK_MODULE}" >> ${modfile}
61 niro 256
62 niro 318 # 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 niro 256 for ((i=0; i <= ALX_COUNT; i++))
68     do
69     [ -n "${ALX_MODULES[${i}]}" ] && \
70 niro 318 echo "${ALX_MODULES[${i}]}" >> ${modfile}
71 niro 256 done
72    
73     unset ALX_COUNT
74     unset ALX_MODULES
75     unset ALX_NETWORK_MODULE
76 niro 318 unset ALX_GFX_MODULE
77 niro 256 }