Be more resilient when the nettree is invalid
This commit is contained in:
		
							
								
								
									
										15
									
								
								sh/net.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								sh/net.sh
									
									
									
									
									
								
							@@ -118,8 +118,8 @@ _show_address() {
 | 
			
		||||
 | 
			
		||||
# Basically sorts our modules into order and saves the list
 | 
			
		||||
_gen_module_list() {
 | 
			
		||||
	local x= f=
 | 
			
		||||
	if [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ] ; then
 | 
			
		||||
	local x= f= force=$1
 | 
			
		||||
	if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ] ; then
 | 
			
		||||
		local update=false
 | 
			
		||||
		for x in "${MODULESDIR}"/* ; do
 | 
			
		||||
			[ -e "${x}" ] || continue
 | 
			
		||||
@@ -230,18 +230,21 @@ _gen_module_list() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_load_modules() {
 | 
			
		||||
	# Ensure our list is up to date
 | 
			
		||||
	_gen_module_list
 | 
			
		||||
 | 
			
		||||
	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=
 | 
			
		||||
	if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then
 | 
			
		||||
		eval mymods=\$modules_${IFVAR}
 | 
			
		||||
		[ -z "${mymods}" ] && mymods=${modules}
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	. "${MODULESLIST}"
 | 
			
		||||
	local i=-1 x= mod= f= provides=
 | 
			
		||||
	while true ; do
 | 
			
		||||
		i=$((${i} + 1))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user