Embed newlines in __IFS to save our identing
This commit is contained in:
		
							
								
								
									
										16
									
								
								sh/net.sh
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								sh/net.sh
									
									
									
									
									
								
							@@ -10,6 +10,10 @@ _config_vars="config routes"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
description="Configures network interfaces."
 | 
					description="Configures network interfaces."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Handy var so we don't have to embed new lines everywhere for array splitting
 | 
				
			||||||
 | 
					__IFS="	
 | 
				
			||||||
 | 
					"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
depend() {
 | 
					depend() {
 | 
				
			||||||
	local IFACE=${SVCNAME#*.}
 | 
						local IFACE=${SVCNAME#*.}
 | 
				
			||||||
	local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g')
 | 
						local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g')
 | 
				
			||||||
@@ -57,6 +61,7 @@ _get_array() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	eval _a=\$$1
 | 
						eval _a=\$$1
 | 
				
			||||||
	printf "%s" "${_a}"
 | 
						printf "%s" "${_a}"
 | 
				
			||||||
 | 
						printf "\n"
 | 
				
			||||||
	[ -n "${_a}" ]
 | 
						[ -n "${_a}" ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -218,9 +223,6 @@ _gen_module_list() {
 | 
				
			|||||||
		eval PROGRAM=\$${MODULE}_program
 | 
							eval PROGRAM=\$${MODULE}_program
 | 
				
			||||||
		eval PROGRAM_START=\$${MODULE}_program_start
 | 
							eval PROGRAM_START=\$${MODULE}_program_start
 | 
				
			||||||
		eval PROGRAM_STOP=\$${MODULE}_program_stop
 | 
							eval PROGRAM_STOP=\$${MODULE}_program_stop
 | 
				
			||||||
		#for x in ${PROGRAM} ; do
 | 
					 | 
				
			||||||
		#	[ -x "${x}" ] || continue 2
 | 
					 | 
				
			||||||
		#done
 | 
					 | 
				
			||||||
		eval PROVIDE=\$${MODULE}_provide
 | 
							eval PROVIDE=\$${MODULE}_provide
 | 
				
			||||||
		echo "module_${i}='${MODULE}'" >> "${MODULESLIST}"
 | 
							echo "module_${i}='${MODULE}'" >> "${MODULESLIST}"
 | 
				
			||||||
		echo "module_${i}_program='${PROGRAM}'" >> "${MODULESLIST}"
 | 
							echo "module_${i}_program='${PROGRAM}'" >> "${MODULESLIST}"
 | 
				
			||||||
@@ -359,8 +361,7 @@ ${config}"
 | 
				
			|||||||
	# We store our config in an array like vars
 | 
						# We store our config in an array like vars
 | 
				
			||||||
	# so modules can influence it
 | 
						# so modules can influence it
 | 
				
			||||||
	config_index=0
 | 
						config_index=0
 | 
				
			||||||
	local IFS="
 | 
						local IFS="$__IFS"
 | 
				
			||||||
"
 | 
					 | 
				
			||||||
	for cmd in ${config}; do
 | 
						for cmd in ${config}; do
 | 
				
			||||||
		eval config_${config_index}="'${cmd}'"
 | 
							eval config_${config_index}="'${cmd}'"
 | 
				
			||||||
		config_index=$((${config_index} + 1))
 | 
							config_index=$((${config_index} + 1))
 | 
				
			||||||
@@ -370,7 +371,6 @@ ${config}"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	config_index=0
 | 
						config_index=0
 | 
				
			||||||
	for cmd in ${fallback}; do
 | 
						for cmd in ${fallback}; do
 | 
				
			||||||
		eval fallback_${config_index}="'${cmd}'"
 | 
					 | 
				
			||||||
		config_index=$((${config_index} + 1))
 | 
							config_index=$((${config_index} + 1))
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	# Terminate the list
 | 
						# Terminate the list
 | 
				
			||||||
@@ -498,8 +498,7 @@ start() {
 | 
				
			|||||||
${routes}"
 | 
					${routes}"
 | 
				
			||||||
		hidefirstroute=true
 | 
							hidefirstroute=true
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	local IFS="
 | 
						local IFS="$__IFS"
 | 
				
			||||||
"
 | 
					 | 
				
			||||||
	for cmd in ${routes}; do
 | 
						for cmd in ${routes}; do
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
		if ${first}; then
 | 
							if ${first}; then
 | 
				
			||||||
@@ -529,6 +528,7 @@ ${routes}"
 | 
				
			|||||||
		eend $?
 | 
							eend $?
 | 
				
			||||||
		eoutdent
 | 
							eoutdent
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
						unset IFS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for module in ${MODULES} ; do
 | 
						for module in ${MODULES} ; do
 | 
				
			||||||
		if type "${module}_post_start" >/dev/null 2>/dev/null ; then
 | 
							if type "${module}_post_start" >/dev/null 2>/dev/null ; then
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user