#! /bin/sh
case "$1" in
	start|"")
		if [ "$VERBOSE" != no ]; then
			printf "Loading modules: "
			if [ -r /etc/modules ]; then
				cat /etc/modules | while read m; do
					conf=/etc/modprobe.d/${m}.conf
                                	uci -q show keenfalcon.${m} | grep -vE '=section$' | sed "s/keenfalcon\.${m}\.//" | sed "s/'//g" | while read opt; do
                                		echo "options ${m} ${opt}" >> ${conf}
                                	done
                                	
                                	if [ ! -s ${conf} ]; then
                                		rm -f ${conf}
                                	fi
					modprobe ${m}
				done
			fi
			echo "OK"
		fi
		;;
		
	*)
		;;
esac
