slitaz-boot-scripts rev 396 5.7.1

network.sh: kinda we can now start and stop connections, as well to re-connect wlan <-> eth without stopping, as well to connect hidden network not knowing it's bssid.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Mar 25 00:29:33 2015 +0200 (2015-03-25)
parents 7acd64a8f538
children fb3932bbddf8
files etc/init.d/network.sh
line diff
     1.1 --- a/etc/init.d/network.sh	Mon Mar 23 18:18:15 2015 +0000
     1.2 +++ b/etc/init.d/network.sh	Wed Mar 25 00:29:33 2015 +0200
     1.3 @@ -12,7 +12,6 @@
     1.4  
     1.5  WPA_CONF='/etc/wpa/wpa.conf'
     1.6  
     1.7 -
     1.8  # Migrate existing settings to a new format file
     1.9  
    1.10  . /usr/share/slitaz/network.conf_migration
    1.11 @@ -39,7 +38,7 @@
    1.12  # Use ethernet
    1.13  
    1.14  eth() {
    1.15 -	[ "$WIFI" != 'yes' ] && ifconfig $INTERFACE up
    1.16 +	[ "$WIFI" != 'yes' ] && ifconfig $INTERFACE up & sleep 5
    1.17  }
    1.18  
    1.19  
    1.20 @@ -126,9 +125,12 @@
    1.21  	ssid="$WIFI_ESSID"
    1.22  EOT
    1.23  
    1.24 -		# For networks with hidden SSID: write its BSSID and allow probe requests
    1.25 +		# For networks with hidden SSID: write its BSSID
    1.26  		[ -n "$WIFI_BSSID" ] && cat >> $WPA_CONF <<EOT
    1.27  	bssid=$WIFI_BSSID
    1.28 +EOT
    1.29 +		# Allow probe requests (for all networks)
    1.30 +		cat >> $WPA_CONF <<EOT
    1.31  	scan_ssid=1
    1.32  EOT
    1.33  
    1.34 @@ -269,7 +271,9 @@
    1.35  
    1.36  stop() {
    1.37  	echo 'Stopping all interfaces'
    1.38 -	ifconfig $INTERFACE down
    1.39 +	for iface in $(ifconfig | sed -e '/^[^ ]/!d' -e 's|^\([^ ]*\) .*|\1|' -e '/lo/d'); do
    1.40 +		ifconfig $iface down
    1.41 +	done
    1.42  	ifconfig $WIFI_INTERFACE down
    1.43  
    1.44  	echo 'Killing all daemons'
    1.45 @@ -284,10 +288,9 @@
    1.46  
    1.47  
    1.48  start() {
    1.49 -	eth
    1.50 -	wifi
    1.51 -	dhcp
    1.52 -	static_ip
    1.53 +	stop
    1.54 +	eth; wifi
    1.55 +	dhcp; static_ip
    1.56  	reconnect_wifi_network
    1.57  
    1.58  	# change default LXPanel panel iface