1 |
# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_modules.sh,v 1.1 2008-06-04 16:47:56 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_modules.sh,v 1.4 2008-06-05 19:40:18 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 |
|
|
|
kernel_major_version() |
|
|
{ |
|
|
local KV |
|
|
KV="$(uname -r | cut -d. -f1-2)" |
|
|
echo "${KV}" |
|
|
} |
|
|
|
|
|
get_modules_settings() |
|
|
{ |
|
|
local i count mod_ids settings |
|
|
|
|
|
# first get all module names |
|
|
mod_ids=$(mysqldo "select id from cfg_modules where serial='${ALX_SERIAL}'") |
|
|
|
|
|
# set counter equal to numbers of printers |
|
|
declare -i count=0 |
|
|
for i in ${mod_ids} |
|
|
do |
|
|
# now get the other settings und put them in arrays |
|
|
ALX_MODULES[${count}]=$(mysqldo "select module from cfg_modules where id=${i};") |
|
|
(( count++ )) |
|
|
done |
|
|
|
|
|
# get network module |
|
|
ALX_NETWORK_MODULE=$(mysqldo "select module from cfg_network where serial=${ALX_SERIAL};") |
|
|
|
|
|
## fixes needed to satisfy some deps |
|
|
ALX_GFX_MODULE=$(mysqldo "select module from cfg_graphic where serial=${ALX_SERIAL};") |
|
|
|
|
|
# export all settings |
|
|
export ALX_COUNT=${count} |
|
|
export ALX_NETWORK_MODULE |
|
|
export ALX_GFX_MODULE |
|
|
export ALX_MODULES |
|
|
} |
|
|
|
|
5 |
add_modules() |
add_modules() |
6 |
{ |
{ |
7 |
local modules="$@" |
local modules="$@" |
8 |
local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" |
local modfile="/etc/modules.autoload" |
9 |
local mod |
local mod |
10 |
|
|
11 |
for mod in ${modules} |
for mod in ${modules} |
12 |
do |
do |
13 |
[ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ] && \ |
[[ -n $(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*) ]] && \ |
14 |
echo "${mod}" >> ${modfile} |
echo "${mod}" >> ${modfile} |
15 |
done |
done |
16 |
} |
} |
17 |
|
|
18 |
config_modules() |
config_modules() |
19 |
{ |
{ |
|
local i |
|
20 |
local modfile |
local modfile |
21 |
|
local modules_list |
|
# first of all get the vars |
|
|
get_modules_settings |
|
22 |
|
|
23 |
# location of the modules.autoload file |
# location of the modules.autoload file |
24 |
modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" |
modfile="/etc/modules.autoload" |
25 |
|
|
26 |
# clear the old one |
# clear the old one |
27 |
:> ${modfile} |
:> ${modfile} |
29 |
# needed for printing: |
# needed for printing: |
30 |
add_modules lp parport parport_pc |
add_modules lp parport parport_pc |
31 |
|
|
32 |
[ -n "${ALX_NETWORK_MODULE}" ] && \ |
# get all available modules-ids |
33 |
echo "${ALX_NETWORK_MODULE}" >> ${modfile} |
modules_list=$(mysqldo "select module from cfg_modules where serial='${ALX_SERIAL}'") |
34 |
|
[[ ! -z ${modules_list} ]] && add_modules ${modules_list} |
35 |
# intel i810 needs intel-agp module to work probably |
|
36 |
[[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp |
# network modules - but exclude "auto" modules |
37 |
|
modules_list=$(mysqldo "select module from cfg_interfaces where serial='${ALX_SERIAL}' and not module='auto'") |
38 |
for ((i=0; i <= ALX_COUNT; i++)) |
[[ ! -z ${modules_list} ]] && add_modules ${modules_list} |
39 |
do |
|
40 |
[ -n "${ALX_MODULES[${i}]}" ] && \ |
# fixme: does udev handle this already?? i think so! |
41 |
echo "${ALX_MODULES[${i}]}" >> ${modfile} |
# special agp and drm modules needed by some graphic drivers |
42 |
done |
evaluate_table cfg_graphic |
43 |
|
case ${cfg_grafic_module} in |
44 |
unset ALX_COUNT |
# intel i810 needs intel-agp module to work probably |
45 |
unset ALX_MODULES |
i810) add_modules intel-agp ;; |
46 |
unset ALX_NETWORK_MODULE |
esac |
|
unset ALX_GFX_MODULE |
|
47 |
} |
} |