# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_modules.sh,v 1.1 2005-04-14 21:24:31 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};") # export all settings export ALX_COUNT=${count} export ALX_NETWORK_MODULE export ALX_MODULES } config_modules() { local i #first of all get the vars get_modules_settings # write default settings: echo "lp" > /etc/modules.autoload.d/kernel-$(kernel_major_version) [ -n "${ALX_NETWORK_MODULE}" ] && \ echo "${ALX_NETWORK_MODULE}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version) for ((i=0; i <= ALX_COUNT; i++)) do [ -n "${ALX_MODULES[${i}]}" ] && \ echo "${ALX_MODULES[${i}]}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version) done unset ALX_COUNT unset ALX_MODULES unset ALX_NETWORK_MODULE }