# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.2 2005-09-01 18:29:56 niro Exp $ # configures printing on the host via mysql db settings # Note must be the first configure script which will be startet 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=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "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}]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select module from cfg_modules where id=${i};") (( count++ )) done # get network module ALX_NETWORK_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select module from cfg_network where serial=${ALX_SERIAL};") ## fixes needed to satisfy some deps ALX_GFX_MODULE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select module from cfg_grafic where serial=${ALX_SERIAL};") # export all settings export ALX_COUNT=${count} export ALX_NETWORK_MODULE export ALX_GFX_MODULE export ALX_MODULES } config_modules() { local i local modfile #first of all get the vars get_modules_settings # location of the modules.autoload file modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" # write default settings: echo "lp" > ${modfile} [ -n "${ALX_NETWORK_MODULE}" ] && \ echo "${ALX_NETWORK_MODULE}" >> ${modfile} # intel i810 needs intel-agp module to work probably [[ ${ALX_GFX_MODULE} = i810 ]] && \ [ -f /lib/modules/$(uname -r)/kernel/drivers/char/agp/intel-agp.ko ] && \ echo "intel-agp" >> ${modfile} for ((i=0; i <= ALX_COUNT; i++)) do [ -n "${ALX_MODULES[${i}]}" ] && \ echo "${ALX_MODULES[${i}]}" >> ${modfile} done unset ALX_COUNT unset ALX_MODULES unset ALX_NETWORK_MODULE unset ALX_GFX_MODULE }