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 $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.6 2005-10-09 21:28:46 niro Exp $ |
2 |
# configures printing on the host via mysql db settings |
# configures printing on the host via mysql db settings |
3 |
# Note must be the first configure script which will be startet |
# Note must be the first configure script which will be startet |
4 |
|
|
5 |
kernel_major_version() |
kernel_major_version() |
6 |
{ |
{ |
7 |
local KV |
local KV |
8 |
KV="$(uname -r|cut -d. -f1-2)" |
KV="$(uname -r | cut -d. -f1-2)" |
9 |
echo "${KV}" |
echo "${KV}" |
10 |
} |
} |
11 |
|
|
14 |
local i count mod_ids settings |
local i count mod_ids settings |
15 |
|
|
16 |
# first get all module names |
# first get all module names |
17 |
mod_ids=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'") |
|
"select id from cfg_modules where serial='${ALX_SERIAL}'") |
|
18 |
|
|
19 |
# set counter equal to numbers of printers |
# set counter equal to numbers of printers |
20 |
declare -i count=0 |
declare -i count=0 |
21 |
for i in ${mod_ids} |
for i in ${mod_ids} |
22 |
do |
do |
23 |
# now get the other settings und put them in arrays |
# now get the other settings und put them in arrays |
24 |
ALX_MODULES[${count}]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};") |
|
"select module from cfg_modules where id=${i};") |
|
|
|
|
25 |
(( count++ )) |
(( count++ )) |
26 |
done |
done |
27 |
|
|
28 |
# get network module |
# get network module |
29 |
ALX_NETWORK_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_NETWORK_MODULE=$(mysqldo "select module from cfg_network where serial=${ALX_SERIAL};") |
30 |
"select module from cfg_network where serial=${ALX_SERIAL};") |
|
31 |
|
## fixes needed to satisfy some deps |
32 |
|
ALX_GFX_MODULE=$(mysqldo "select module from cfg_graphic where serial=${ALX_SERIAL};") |
33 |
|
|
34 |
# export all settings |
# export all settings |
35 |
export ALX_COUNT=${count} |
export ALX_COUNT=${count} |
36 |
export ALX_NETWORK_MODULE |
export ALX_NETWORK_MODULE |
37 |
|
export ALX_GFX_MODULE |
38 |
export ALX_MODULES |
export ALX_MODULES |
39 |
} |
} |
40 |
|
|
41 |
|
add_modules() |
42 |
|
{ |
43 |
|
local modules="$@" |
44 |
|
local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" |
45 |
|
local mod |
46 |
|
|
47 |
|
for mod in ${modules} |
48 |
|
do |
49 |
|
[ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ] && \ |
50 |
|
echo "${mod}" >> ${modfile} |
51 |
|
done |
52 |
|
} |
53 |
|
|
54 |
config_modules() |
config_modules() |
55 |
{ |
{ |
56 |
local i |
local i |
57 |
|
local modfile |
58 |
|
|
59 |
#first of all get the vars |
# first of all get the vars |
60 |
get_modules_settings |
get_modules_settings |
61 |
|
|
62 |
# write default settings: |
# location of the modules.autoload file |
63 |
echo "lp" > /etc/modules.autoload.d/kernel-$(kernel_major_version) |
modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" |
64 |
|
|
65 |
|
# clear the old one |
66 |
|
:> ${modfile} |
67 |
|
|
68 |
|
# needed for printing: |
69 |
|
add_modules lp parport parport_pc |
70 |
|
|
71 |
[ -n "${ALX_NETWORK_MODULE}" ] && \ |
[ -n "${ALX_NETWORK_MODULE}" ] && \ |
72 |
echo "${ALX_NETWORK_MODULE}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version) |
echo "${ALX_NETWORK_MODULE}" >> ${modfile} |
73 |
|
|
74 |
|
# intel i810 needs intel-agp module to work probably |
75 |
|
[[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp |
76 |
|
|
77 |
for ((i=0; i <= ALX_COUNT; i++)) |
for ((i=0; i <= ALX_COUNT; i++)) |
78 |
do |
do |
79 |
[ -n "${ALX_MODULES[${i}]}" ] && \ |
[ -n "${ALX_MODULES[${i}]}" ] && \ |
80 |
echo "${ALX_MODULES[${i}]}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version) |
echo "${ALX_MODULES[${i}]}" >> ${modfile} |
|
|
|
81 |
done |
done |
82 |
|
|
83 |
unset ALX_COUNT |
unset ALX_COUNT |
84 |
unset ALX_MODULES |
unset ALX_MODULES |
85 |
unset ALX_NETWORK_MODULE |
unset ALX_NETWORK_MODULE |
86 |
|
unset ALX_GFX_MODULE |
87 |
} |
} |