Be more resilient when the nettree is invalid

This commit is contained in:
Roy Marples 2007-05-18 20:09:10 +00:00
parent 237a66b05c
commit 49347d6f77

View File

@ -118,8 +118,8 @@ _show_address() {
# Basically sorts our modules into order and saves the list # Basically sorts our modules into order and saves the list
_gen_module_list() { _gen_module_list() {
local x= f= local x= f= force=$1
if [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ] ; then if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ] ; then
local update=false local update=false
for x in "${MODULESDIR}"/* ; do for x in "${MODULESDIR}"/* ; do
[ -e "${x}" ] || continue [ -e "${x}" ] || continue
@ -230,18 +230,21 @@ _gen_module_list() {
} }
_load_modules() { _load_modules() {
# Ensure our list is up to date
_gen_module_list
local starting=$1 mymods= local starting=$1 mymods=
# Ensure our list is up to date
_gen_module_list false
if ! . "${MODULESLIST}" ; then
_gen_module_list true
. "${MODULESLIST}"
fi
MODULES= MODULES=
if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then
eval mymods=\$modules_${IFVAR} eval mymods=\$modules_${IFVAR}
[ -z "${mymods}" ] && mymods=${modules} [ -z "${mymods}" ] && mymods=${modules}
fi fi
. "${MODULESLIST}"
local i=-1 x= mod= f= provides= local i=-1 x= mod= f= provides=
while true ; do while true ; do
i=$((${i} + 1)) i=$((${i} + 1))