# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_modules.sh,v 1.1 2008-06-04 16:47: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=$(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 } add_modules() { local modules="$@" local modfile="/etc/modules.autoload.d/kernel-$(kernel_major_version)" local mod for mod in ${modules} do [ -n "$(find /lib/modules/$(uname -r) -name ${mod}.[o,k]*)" ] && \ echo "${mod}" >> ${modfile} done } 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)" # clear the old one :> ${modfile} # needed for printing: add_modules lp parport parport_pc [ -n "${ALX_NETWORK_MODULE}" ] && \ echo "${ALX_NETWORK_MODULE}" >> ${modfile} # intel i810 needs intel-agp module to work probably [[ ${ALX_GFX_MODULE} = i810 ]] && add_modules intel-agp 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 }