wok-current rev 15760

busybox-boot: do not trust args
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jan 05 16:11:29 2014 +0000 (2014-01-05)
parents d301c5bb3cc7
children e5b70d287abc
files busybox-boot/receipt
line diff
     1.1 --- a/busybox-boot/receipt	Sun Jan 05 02:48:00 2014 +0100
     1.2 +++ b/busybox-boot/receipt	Sun Jan 05 16:11:29 2014 +0000
     1.3 @@ -44,15 +44,16 @@
     1.4  export HOME=/
     1.5  export TERM=vt100
     1.6  
     1.7 -if [ -n "\$1" ]; then
     1.8 +if [ -d /etc ]; then
     1.9 +	[ -n "\$domain" ] && echo search \$domain > /etc/resolv.conf
    1.10 +	for i in \$dns ; do echo nameserver \$i; done >> /etc/resolv.conf
    1.11  	[ -n "\$broadcast" ] && BROADCAST="broadcast \$broadcast"
    1.12  	[ -n "\$subnet" ] && NETMASK="netmask \$subnet"
    1.13 -	ifconfig \$interface \${ip:-0.0.0.0} \$BROADCAST \$NETMASK
    1.14 -	while route del default gw 0.0.0.0 dev \$interface ; do : ; done
    1.15 -	for i in \$router ; do route add default gw \$i dev \$interface; done
    1.16 -	[ -n "\$domain" ] && echo search \$domain > /etc/resolv.conf
    1.17 -	for i in \$dns ; do echo nameserver \$i; done >> /etc/resolv.conf
    1.18 -	exit 0
    1.19 +	if ifconfig \$interface \${ip:-0.0.0.0} \$BROADCAST \$NETMASK ; then
    1.20 +		while route del default gw 0.0.0.0 dev \$interface ; do : ; done
    1.21 +		for i in \$router ; do route add default gw \$i dev \$interface; done
    1.22 +	fi
    1.23 +	exit
    1.24  fi
    1.25  
    1.26  mkdir /tmp /mnt /proc /etc