slitaz-boot-scripts rev 393 5.7

network.sh: better handle WEP connections, handle EAP, store Wi-Fi neworks by default; network.conf: migrate to extended format to support EAP arguments, and few more.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Mar 23 02:01:21 2015 +0200 (2015-03-23)
parents 017e46ba678b
children 0f62401c7b6c
files applications/bootlog.desktop bin/bootlog bin/rcSconf etc/init.d/bootopts.sh etc/init.d/network.sh etc/init.d/rc.shutdown etc/init.d/rcS etc/init.d/system.sh etc/init.d/wpa_action.sh etc/network.conf init usr/bin/bootlog usr/bin/rcSconf usr/share/applications/bootlog.desktop usr/share/slitaz/network.conf_migration
line diff
     1.1 --- a/applications/bootlog.desktop	Sun Mar 22 19:30:39 2015 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,10 +0,0 @@
     1.4 -[Desktop Entry]
     1.5 -Type=Application
     1.6 -Name=Boot Log Viewer
     1.7 -Name[fr]=Log de démarrage
     1.8 -Name[pt]=Visualizar log de boot
     1.9 -Name[pt_BR]=Visualizar log de boot
    1.10 -Name[ru]=Журнал загрузки
    1.11 -Exec=bootlog box
    1.12 -Icon=text-plain
    1.13 -Categories=System;Monitor;
     2.1 --- a/bin/bootlog	Sun Mar 22 19:30:39 2015 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,16 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -#
     2.6 -# Display SliTaz boot log messages
     2.7 -#
     2.8 -
     2.9 -catlog() {
    2.10 -	cat /var/log/dmesg.log /var/log/boot.log | sed "s/.\[3g.*\]R//"
    2.11 -}
    2.12 -
    2.13 -case "$1" in
    2.14 -	box) catlog | sed -e s'///'g -e s'/\[1;3[0-9]m//'g \
    2.15 -		-e s'/\[*.0G\[/ /'g -e s'/\[0;39m.*//'g | yad \
    2.16 -		--text-info --title="Boot Log" --window-icon=text-plain \
    2.17 -		--width=600 --height=400 --button=gtk-close:0 ;;
    2.18 -	*) catlog ;;
    2.19 -esac
     3.1 --- a/bin/rcSconf	Sun Mar 22 19:30:39 2015 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,62 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -#
     3.6 -# Update and clean-up /etc/rcS.conf
     3.7 -#
     3.8 -
     3.9 -# X is now started earlier by system.sh
    3.10 -up_daemons() {
    3.11 -	echo $RUN_DAEMONS | sed \
    3.12 -		-e s/dbus// -e s/hald// -e s/slim// -e s'/   //' -e s'/  //'
    3.13 -}
    3.14 -
    3.15 -case "$1" in
    3.16 -	up)
    3.17 -		[ $(id -u) != 0 ] && exit 0
    3.18 -		#check_root: broken gettext in libtaz.sh
    3.19 -		. /etc/rcS.conf
    3.20 -		cp -f /etc/rcS.conf /etc/slitaz/rcS.conf.bak
    3.21 -		echo "Updating: /etc/rcS.conf"
    3.22 -		cat > /etc/rcS.conf << EOT
    3.23 -# /etc/rcS.conf : Initial boot script configuration for SliTaz GNU/Linux
    3.24 -# Sourced by    : /etc/init.d/rcS
    3.25 -#
    3.26 -
    3.27 -# Use udev to populate /dev and handle hotplug events
    3.28 -UDEV="$UDEV"
    3.29 -
    3.30 -# Clean up the system removing all tmp and pid files
    3.31 -CLEAN_UP_SYSTEM="$CLEAN_UP_SYSTEM"
    3.32 -
    3.33 -# Filesystems to check integrity of at boot time. You should check the
    3.34 -# rootfs (where SliTaz is installed) and all partitions listed in fstab.
    3.35 -# Example: CHECK_FS="/dev/hda5 /dev/hdb1"
    3.36 -CHECK_FS="$CHECK_FS"
    3.37 -
    3.38 -# Syslogd: Max size (KB) before rotation
    3.39 -SYSLOGD_ROTATED_SIZE="$SYSLOGD_ROTATED_SIZE"
    3.40 -
    3.41 -# Kernel modules to load at boot time
    3.42 -LOAD_MODULES="$LOAD_MODULES"
    3.43 -
    3.44 -# X Login manager: slim or lxdm, empty to disable X
    3.45 -LOGIN_MANAGER="slim"
    3.46 -
    3.47 -# Initialization scripts to run at boot time. The local.sh script
    3.48 -# let you quickly add some local startup commands.
    3.49 -RUN_SCRIPTS="bootopts.sh system.sh network.sh local.sh"
    3.50 -
    3.51 -# Daemons to start at boot time. DBUS daemon is started before the
    3.52 -# login manager and from: /etc/init.d/system.sh
    3.53 -RUN_DAEMONS="$(up_daemons)"
    3.54 -
    3.55 -# Pre login message
    3.56 -MESSAGE="Welcome to your box"
    3.57 -EOT
    3.58 -		diff /etc/slitaz/rcS.conf.bak /etc/rcS.conf > \
    3.59 -			/etc/slitaz/rcS.conf.diff ;;
    3.60 -	show) less -E /etc/rcS.conf ;;
    3.61 -	show-diff) less -E /etc/slitaz/rcS.conf.diff ;;
    3.62 -	clean) rm -f /etc/slitaz/rcS.conf* ;;
    3.63 -	*) echo "Usage: $(basename $0) [up|show|show-diff|clean]" ;;
    3.64 -esac
    3.65 -exit 0
     4.1 --- a/etc/init.d/bootopts.sh	Sun Mar 22 19:30:39 2015 +0100
     4.2 +++ b/etc/init.d/bootopts.sh	Mon Mar 23 02:01:21 2015 +0200
     4.3 @@ -16,15 +16,15 @@
     4.4  }
     4.5  
     4.6  # Parse /proc/cmdline for boot options.
     4.7 -echo "Checking for SliTaz cmdline options..."
     4.8 +echo 'Checking for SliTaz cmdline options...'
     4.9  
    4.10  # Default user account without password (uid=1000). In live mode the option
    4.11  # user=name can be used, but user must be added before home= to have home dir.
    4.12  # This option is not handled by a loop and case like others and has no
    4.13  # effect on an installed system.
    4.14 -if ! grep -q "100[0-9]:100" /etc/passwd; then
    4.15 +if ! grep -q '100[0-9]:100' /etc/passwd; then
    4.16  
    4.17 -	if fgrep -q "user=" /proc/cmdline; then
    4.18 +	if fgrep -q 'user=' /proc/cmdline; then
    4.19  		USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/')
    4.20  		# Avoid usage of an existing system user or root.
    4.21  		if grep -q ^$USER /etc/passwd; then
    4.22 @@ -33,38 +33,37 @@
    4.23  	else
    4.24  		USER=tux
    4.25  	fi
    4.26 -	
    4.27 +
    4.28  	# Make sure we have users applications.conf
    4.29 -	if [ ! -f "/etc/skel/.config/slitaz/applications.conf" -a \
    4.30 -	     -f "/etc/slitaz/applications.conf" ]; then
    4.31 +	if [ ! -f '/etc/skel/.config/slitaz/applications.conf' -a \
    4.32 +		-f '/etc/slitaz/applications.conf' ]; then
    4.33  		mkdir -p /etc/skel/.config/slitaz
    4.34  		cp /etc/slitaz/applications.conf /etc/skel/.config/slitaz
    4.35  	fi
    4.36 -	
    4.37 +
    4.38  	echo -n "Configuring user and group: $USER..."
    4.39 -	adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER
    4.40 +	adduser -D -s /bin/sh -g 'SliTaz User' -G users -h /home/$USER $USER
    4.41  	passwd -d $USER >/dev/null
    4.42 -	for group in audio cdrom video tty plugdev disk
    4.43 -	do
    4.44 -		addgroup $USER ${group}
    4.45 +	for group in audio cdrom video tty plugdev disk; do
    4.46 +		addgroup $USER $group
    4.47  	done
    4.48  	status
    4.49 -	
    4.50 +
    4.51  	# Slim default user
    4.52  	if [ -f /etc/slim.conf ]; then
    4.53 -		sed -i s/"default_user .*"/"default_user    $USER"/ /etc/slim.conf
    4.54 +		sed -i "s|default_user .*|default_user    $USER|" /etc/slim.conf
    4.55  	fi
    4.56  fi
    4.57  
    4.58 -for opt in $(cat /proc/cmdline)
    4.59 -do
    4.60 +for opt in $(cat /proc/cmdline); do
    4.61  	case $opt in
    4.62  		eject)
    4.63  			# Eject cdrom.
    4.64  			eject /dev/cdrom ;;
    4.65  		autologin)
    4.66  			# Autologin option to skip first graphic login prompt.
    4.67 -			echo "auto_login        yes" >> /etc/slim.conf ;;
    4.68 +			sed -i '/auto_login .*/d' /etc/slim.conf
    4.69 +			echo 'auto_login        yes' >> /etc/slim.conf ;;
    4.70  		lang=*)
    4.71  			# Check for a specified locale (lang=*).
    4.72  			LANG=${opt#lang=}
    4.73 @@ -79,7 +78,9 @@
    4.74  			# Check for a specified console font (font=*).
    4.75  			FONT=${opt#font=}
    4.76  			echo -n "Setting console font to: $FONT..."
    4.77 -			for con in 1 2 3 4 5 6; do setfont $FONT -C /dev/tty$con; done
    4.78 +			for con in 1 2 3 4 5 6; do
    4.79 +				setfont $FONT -C /dev/tty$con
    4.80 +			done
    4.81  			status ;;
    4.82  		home=*)
    4.83  			# Check for a specified home partition (home=*) and check for
    4.84 @@ -88,32 +89,37 @@
    4.85  			DEVICE=${opt#home=}
    4.86  			[ "$DEVICE" = "usb" ] && DEVICE="$(usb_device)1"
    4.87  			echo "Home has been specified to $DEVICE..."
    4.88 -			DEVID=`/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q'`
    4.89 +
    4.90 +			DEVID=$(/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q')
    4.91  			if [ -z "$DEVID" ]; then
    4.92 -				USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    4.93 +				USBDELAY=$(cat /sys/module/usb_storage/parameters/delay_use)
    4.94  				USBDELAY=$((2+$USBDELAY))
    4.95  				echo "Sleeping $USBDELAY s to let the kernel detect the device... "
    4.96  				sleep $USBDELAY
    4.97  			fi
    4.98 -			USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'`
    4.99 +
   4.100 +			USER=$(cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q')
   4.101  			DEVID=$DEVICE
   4.102  			if [ -x /sbin/blkid ]; then
   4.103  				# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
   4.104 -				DEVID=`/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q'`
   4.105 +				DEVID=$(/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q')
   4.106  			fi
   4.107  			DEVID=${DEVID##*/}
   4.108 +
   4.109  			if [ -n "$DEVID" ] && fgrep -q "$DEVID" /proc/partitions ; then
   4.110  				echo "Mounting /home on /dev/$DEVID... "
   4.111  				[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
   4.112  				mount /dev/$DEVID /home &&
   4.113  				case "$(/sbin/blkid | grep /dev/$DEVID:)" in
   4.114 -				*\"ntfs\"*|*\"vfat\"*) mount.posixovl -F /home -- -oallow_other -odefault_permissions -osuid ;;
   4.115 +				*\"ntfs\"*|*\"vfat\"*)
   4.116 +					mount.posixovl -F /home -- -oallow_other -odefault_permissions -osuid ;;
   4.117  				esac
   4.118  				mount /home -o remount,uid=1000,gid=100 2>/dev/null
   4.119 +
   4.120  				# Check if swap file must be generated in /home: swap=size (Mb).
   4.121  				# This option is only used within home=device.
   4.122 -				if grep -q "swap=[1-9]*" /proc/cmdline; then
   4.123 -					SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline`
   4.124 +				if grep -q 'swap=[1-9]*' /proc/cmdline; then
   4.125 +					SWAP_SIZE=$(sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline)
   4.126  					# DD to gen a virtual disk.
   4.127  					echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
   4.128  					dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
   4.129 @@ -124,6 +130,7 @@
   4.130  			else
   4.131  				echo "Unable to find $DEVICE... "
   4.132  			fi
   4.133 +
   4.134  			# Move all user dir if needed.
   4.135  			if [ ! -d "/home/$USER" ] ; then
   4.136  				mv /tmp/$USER-files /home/$USER
   4.137 @@ -131,35 +138,37 @@
   4.138  			else
   4.139  				rm -rf /tmp/$USER-files
   4.140  			fi
   4.141 +
   4.142  			# Install all packages in /home/boot/packages. In live CD and
   4.143  			# USB mode the option home= mounts the device on /home, so we
   4.144  			# already have a boot directory with the Kernel and rootfs.
   4.145 -			if [ -d "/home/boot/packages" ]; then
   4.146 -				for pkg in /home/boot/packages/*.tazpkg
   4.147 -				do
   4.148 +			if [ -d '/home/boot/packages' ]; then
   4.149 +				for pkg in /home/boot/packages/*.tazpkg; do
   4.150  					tazpkg install $pkg
   4.151  				done
   4.152  			fi
   4.153 +
   4.154  			# We can have custom files in /home/boot/rootfs to overwrite
   4.155  			# the one packed into the Live system.
   4.156 -			if [ -d "/home/boot/rootfs" ]; then
   4.157 +			if [ -d '/home/boot/rootfs' ]; then
   4.158  				cp -a /home/boot/rootfs/* /
   4.159  			fi ;;
   4.160  		laptop)
   4.161  			# Enable Kernel Laptop mode.
   4.162 -			echo "5" > /proc/sys/vm/laptop_mode ;;
   4.163 +			echo '5' > /proc/sys/vm/laptop_mode ;;
   4.164  		mount)
   4.165  			# Mount all ext3 partitions found (opt: mount).
   4.166 +
   4.167  			# Get the list of partitions.
   4.168 -			DEVICES_LIST=`fdisk -l | sed '/83 Linux/!d;s/ .*//'`
   4.169 +			DEVICES_LIST=$(fdisk -l | sed '/83 Linux/!d;s/ .*//')
   4.170 +
   4.171  			# Mount filesystems rw.
   4.172 -			for device in $DEVICES_LIST
   4.173 -			do
   4.174 +			for device in $DEVICES_LIST; do
   4.175  				name=${device#/dev/}
   4.176  				# Device can be already used by home=usb.
   4.177  				if ! mount | grep ^$device >/dev/null; then
   4.178  					echo "Mounting partition: $name on /mnt/$name"
   4.179 -					mkdir /mnt/$name
   4.180 +					mkdir -p /mnt/$name
   4.181  					mount $device /mnt/$name
   4.182  				fi
   4.183  			done ;;
   4.184 @@ -172,7 +181,7 @@
   4.185  				PKGDEV=$(blkid /dev/cdrom | grep "$PKGSIGN" | cut -d: -f1)
   4.186  			if [ -n "$PKGDEV" ]; then
   4.187  				echo -n "Mounting packages archive from $PKGDEV..."
   4.188 -				mkdir /packages && mount -t iso9660 -o ro $PKGDEV /packages
   4.189 +				mkdir -p /packages; mount -t iso9660 -o ro $PKGDEV /packages
   4.190  				status
   4.191  				/packages/install.sh
   4.192  			fi ;;
     5.1 --- a/etc/init.d/network.sh	Sun Mar 22 19:30:39 2015 +0100
     5.2 +++ b/etc/init.d/network.sh	Mon Mar 23 02:01:21 2015 +0200
     5.3 @@ -1,24 +1,33 @@
     5.4  #!/bin/sh
     5.5  #
     5.6  # /etc/init.d/network.sh : Network initialization boot script
     5.7 -# Configuration file     : /etc/network.conf
     5.8 -#
     5.9 +# /etc/network.conf      : Main SliTaz network configuration file
    5.10 +# /etc/wpa/wpa.conf      : Wi-Fi networks configuration file
    5.11 +
    5.12  . /etc/init.d/rc.functions
    5.13  
    5.14 -if [ -z "$2" ]; then
    5.15 -	. /etc/network.conf
    5.16 -else
    5.17 -	. $2
    5.18 -fi
    5.19 +CONF="${2:-/etc/network.conf}"
    5.20 +echo "Loading network settings from $CONF"
    5.21 +. "$CONF"
    5.22 +
    5.23 +WPA_CONF='/etc/wpa/wpa.conf'
    5.24 +
    5.25 +
    5.26 +# Migrate existing settings to a new format file
    5.27 +
    5.28 +. /usr/share/slitaz/network.conf_migration
    5.29 +
    5.30 +
    5.31 +# Actions executing on boot time (running network.sh without parameters)
    5.32  
    5.33  boot() {
    5.34 -	# Set hostname.
    5.35 +	# Set hostname
    5.36  	echo -n "Setting hostname to: $(cat /etc/hostname)"
    5.37  	/bin/hostname -F /etc/hostname
    5.38  	status
    5.39  
    5.40 -	# Configure loopback interface.
    5.41 -	echo -n "Configuring loopback..."
    5.42 +	# Configure loopback interface
    5.43 +	echo -n 'Configuring loopback...'
    5.44  	/sbin/ifconfig lo 127.0.0.1 up
    5.45  	/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
    5.46  	status
    5.47 @@ -26,225 +35,288 @@
    5.48  	[ -s /etc/sysctl.conf ] && sysctl -p /etc/sysctl.conf
    5.49  }
    5.50  
    5.51 +
    5.52  # Use ethernet
    5.53 +
    5.54  eth() {
    5.55 -	ifconfig $INTERFACE up
    5.56 +	[ "$WIFI" != 'yes' ] && ifconfig $INTERFACE up
    5.57  }
    5.58  
    5.59 -# For wifi. Users just have to enable it through yes and usually
    5.60 -# essid any will work and the interface is autodetected.
    5.61 +
    5.62 +# Start wpa_supplicant with prepared settings in wpa.conf
    5.63 +
    5.64 +start_wpa_supplicant() {
    5.65 +	echo "Starting wpa_supplicant for $1..."
    5.66 +	wpa_supplicant -B -W -c$WPA_CONF -D$WIFI_WPA_DRIVER -i$WIFI_INTERFACE
    5.67 +}
    5.68 +
    5.69 +
    5.70 +# Reconnect to the given network
    5.71 +
    5.72 +reconnect_wifi_network() {
    5.73 +	if [ "$WIFI" == 'yes' ]; then
    5.74 +		# Wpa_supplicant will auto-connect to the first network
    5.75 +		# notwithstanding to priority when scan_ssid=1
    5.76 +		current_ssid="$(wpa_cli list_networks 2>/dev/null | fgrep '[CURRENT]' | cut -f2)"
    5.77 +		if [ "$current_ssid" != "$WIFI_ESSID" ]; then
    5.78 +			echo "Connecting to $WIFI_ESSID..."
    5.79 +			for i in $(seq 20); do
    5.80 +				index=$(wpa_cli list_networks 2>/dev/null | \
    5.81 +					grep -m1 -F $'\t'$WIFI_ESSID$'\t' | head -n1 | cut -f1)
    5.82 +				[ -z "$index" ] && echo -n '.' && sleep 1
    5.83 +			done
    5.84 +			wpa_cli select_network $index >/dev/null; status
    5.85 +		fi
    5.86 +	fi
    5.87 +}
    5.88 +
    5.89 +
    5.90 +# For Wi-Fi. Users just have to enable it through WIFI="yes" and usually
    5.91 +# ESSID="any" will work and the interface is autodetected.
    5.92 +
    5.93  wifi() {
    5.94 -	if [ "$WIFI" == "yes" ]; then
    5.95 +	if [ "$WIFI" == 'yes' ]; then
    5.96  		ifconfig $INTERFACE down
    5.97  
    5.98 -		# Confirm if $WIFI_INTERFACE is the wifi interface
    5.99 +		# Confirm if $WIFI_INTERFACE is the Wi-Fi interface
   5.100  		if [ ! -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
   5.101 -			echo "$WIFI_INTERFACE is not a wifi interface, changing it."
   5.102 -			WIFI_INTERFACE=$(fgrep : /proc/net/dev | cut -d: -f1 | \
   5.103 -				while read dev; do iwconfig $dev 2>&1 | \
   5.104 -					fgrep -iq "essid" && { echo $dev ; break; }; \
   5.105 -				done)
   5.106 +			echo "$WIFI_INTERFACE is not a Wi-Fi interface, changing it."
   5.107 +			WIFI_INTERFACE=$(iwconfig 2>/dev/null | awk 'NR==1{print $1}')
   5.108  			[ -n "$WIFI_INTERFACE" ] && sed -i \
   5.109 -				"s/^WIFI_INTERFACE=.*/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" \
   5.110 +				"s|^WIFI_INTERFACE=.*|WIFI_INTERFACE=\"$WIFI_INTERFACE\"|" \
   5.111  				/etc/network.conf
   5.112  		fi
   5.113  
   5.114 -		echo -n "Configuring $WIFI_INTERFACE..."
   5.115 +		echo -n "Configuring Wi-Fi interface $WIFI_INTERFACE..."
   5.116  		ifconfig $WIFI_INTERFACE up 2>/dev/null
   5.117 -		if iwconfig $WIFI_INTERFACE | fgrep -q "Tx-Power"; then
   5.118 +		if iwconfig $WIFI_INTERFACE | fgrep -q 'Tx-Power'; then
   5.119  			iwconfig $WIFI_INTERFACE txpower on
   5.120  		fi
   5.121  		status
   5.122  
   5.123 -		IWCONFIG_ARGS=""
   5.124 -		[ -n "$WPA_DRIVER" ] || WPA_DRIVER="wext"
   5.125 -		[ -n "$WIFI_MODE" ] && IWCONFIG_ARGS="$IWCONFIG_ARGS mode $WIFI_MODE"
   5.126 +		IWCONFIG_ARGS=''
   5.127 +		[ -n "$WIFI_WPA_DRIVER" ] || WIFI_WPA_DRIVER='wext'
   5.128 +		[ -n "$WIFI_MODE" ]    && IWCONFIG_ARGS="$IWCONFIG_ARGS mode $WIFI_MODE"
   5.129  		[ -n "$WIFI_CHANNEL" ] && IWCONFIG_ARGS="$IWCONFIG_ARGS channel $WIFI_CHANNEL"
   5.130 -		[ -n "$WIFI_AP" ] && IWCONFIG_ARGS="$IWCONFIG_ARGS ap $WIFI_AP"
   5.131 -		
   5.132 -		# Unencrypted network
   5.133 -		if [ "$WIFI_KEY" == "" -o "$WIFI_KEY_TYPE" == "" ]; then
   5.134 -			iwconfig $WIFI_INTERFACE essid "$WIFI_ESSID" $IWCONFIG_ARGS
   5.135 +		[ -n "$WIFI_AP" ]      && IWCONFIG_ARGS="$IWCONFIG_ARGS ap $WIFI_AP"
   5.136 +
   5.137 +		# Clean all / add / change stored networks settings
   5.138 +		if [ "$WIFI_BLANK_NETWORKS" == 'yes' ]; then
   5.139 +			echo "Creating new $WPA_CONF"
   5.140 +			cat /etc/wpa/wpa_empty.conf > $WPA_CONF
   5.141 +		else
   5.142 +			if fgrep -q ssid=\"$WIFI_ESSID\" $WPA_CONF; then
   5.143 +				echo "Change network settings in $WPA_CONF"
   5.144 +				# Remove given existing network (it to be appended later)
   5.145 +				mv -f $WPA_CONF $WPA_CONF.old
   5.146 +				cat $WPA_CONF.old | tr '\n' '\a' | sed 's|[^#]\(network={\)|\n\1|g' | \
   5.147 +				fgrep -v "ssid=\"$WIFI_ESSID\"" | tr '\a' '\n' > $WPA_CONF
   5.148 +			else
   5.149 +				echo "Append existing $WPA_CONF"
   5.150 +			fi
   5.151  		fi
   5.152 -		
   5.153 -		# Encrypted network
   5.154 -		[ -n "$WIFI_KEY" ] && case "$WIFI_KEY_TYPE" in
   5.155 -			wep|WEP)
   5.156 -				# wpa_supplicant can also deal with wep encryption
   5.157 -				# Tip: Use unquoted strings for hexadecimal key in wep_key0
   5.158 -				echo "Creating: /etc/wpa/wpa.conf"
   5.159 -				cat /etc/wpa/wpa_empty.conf > /etc/wpa/wpa.conf
   5.160 -				cat >> /etc/wpa/wpa.conf << EOT
   5.161 +
   5.162 +		# Each new network has a higher priority than the existing
   5.163 +		MAX_PRIORITY=$(sed -n 's|[\t ]*priority=\([0-9]*\)|\1|p' $WPA_CONF | sort -g | tail -n1)
   5.164 +		PRIORITY=$(( ${MAX_PRIORITY:-0} + 1 ))
   5.165 +
   5.166 +		# Begin network description
   5.167 +		cat >> $WPA_CONF <<EOT
   5.168  network={
   5.169  	ssid="$WIFI_ESSID"
   5.170 +EOT
   5.171 +
   5.172 +		# For networks with hidden SSID: write its BSSID and allow probe requests
   5.173 +		[ -n "$WIFI_BSSID" ] && cat >> $WPA_CONF <<EOT
   5.174 +	bssid=$WIFI_BSSID
   5.175  	scan_ssid=1
   5.176 +EOT
   5.177 +
   5.178 +		case x$(echo -n $WIFI_KEY_TYPE | tr a-z A-Z) in
   5.179 +			x|xNONE) # Open network
   5.180 +				cat >> $WPA_CONF <<EOT
   5.181  	key_mgmt=NONE
   5.182 -	wep_key0=$WIFI_KEY
   5.183 -	wep_tx_keyidx=0
   5.184 -	priority=5
   5.185 +	priority=$PRIORITY
   5.186  }
   5.187  EOT
   5.188 -				echo "Starting wpa_supplicant for NONE/WEP..."
   5.189 -				wpa_supplicant -B -W -c/etc/wpa/wpa.conf -D$WPA_DRIVER \
   5.190 -					-i$WIFI_INTERFACE ;;
   5.191 -			
   5.192 -			wpa|WPA)
   5.193 -				# load pre-configured multiple profiles
   5.194 -				echo "Creating: /etc/wpa/wpa.conf"
   5.195 -				cat /etc/wpa/wpa_empty.conf > /etc/wpa/wpa.conf
   5.196 -				if [ "$WIFI_IDENTITY" ]; then
   5.197 -					cat >> /etc/wpa/wpa.conf << EOT
   5.198 -network={
   5.199 -	ssid="$WIFI_ESSID"
   5.200 -	key_mgmt=WPA-EAP
   5.201 -	scan_ssid=1
   5.202 -	identity="$WIFI_IDENTITY"
   5.203 -	password="$WIFI_PASSWORD"
   5.204 +				# start_wpa_supplicant NONE
   5.205 +				iwconfig $WIFI_INTERFACE essid "$WIFI_ESSID" $IWCONFIG_ARGS
   5.206 +				;;
   5.207 +
   5.208 +			xWEP) # WEP security
   5.209 +				# Encryption key length:  64 bit  (5 ASCII or 10 HEX)
   5.210 +				# Encryption key length: 128 bit (13 ASCII or 26 HEX)
   5.211 +				# ASCII key in "quotes", HEX key without quotes
   5.212 +				case "${#WIFI_KEY}" in
   5.213 +					10|26) Q=''  ;;
   5.214 +					*)     Q='"' ;;
   5.215 +				esac
   5.216 +				cat >> $WPA_CONF <<EOT
   5.217 +	key_mgmt=NONE
   5.218 +	auth_alg=OPEN SHARED
   5.219 +	wep_key0=$Q$WIFI_KEY$Q
   5.220 +	priority=$PRIORITY
   5.221  }
   5.222  EOT
   5.223 -				else
   5.224 -					cat >> /etc/wpa/wpa.conf << EOT
   5.225 -network={
   5.226 -	ssid="$WIFI_ESSID"
   5.227 -	scan_ssid=1
   5.228 -	proto=WPA RSN
   5.229 -	key_mgmt=WPA-PSK WPA-EAP
   5.230 +				start_wpa_supplicant WEP ;;
   5.231 +
   5.232 +			xWPA) # WPA/WPA2-PSK security
   5.233 +				cat >> $WPA_CONF <<EOT
   5.234  	psk="$WIFI_KEY"
   5.235 -	priority=5
   5.236 +	key_mgmt=WPA-PSK
   5.237 +	priority=$PRIORITY
   5.238  }
   5.239  EOT
   5.240 -				fi
   5.241 -				echo "Starting wpa_supplicant for WPA-PSK..."
   5.242 -				wpa_supplicant -B -W -c/etc/wpa/wpa.conf \
   5.243 -					-D$WPA_DRIVER -i$WIFI_INTERFACE ;;
   5.244 -			
   5.245 -			any|ANY)
   5.246 -				echo "Creating: /etc/wpa/wpa.conf"
   5.247 -				cat /etc/wpa/wpa_empty.conf > /etc/wpa/wpa.conf
   5.248 -				cat >> /etc/wpa/wpa.conf << EOT
   5.249 -network={
   5.250 -	ssid="$WIFI_ESSID"
   5.251 -	scan_ssid=1
   5.252 +				start_wpa_supplicant WPA/WPA2-PSK ;;
   5.253 +
   5.254 +			xEAP) # 802.1x EAP security
   5.255 +				{
   5.256 +					cat <<EOT
   5.257 +	key_mgmt=WPA-EAP IEEE8021X
   5.258 +	eap=$WIFI_EAP_METHOD
   5.259 +EOT
   5.260 +					if [ "$WIFI_EAP_METHOD" == 'PWD' ]; then
   5.261 +						WIFI_PHASE2=''; WIFI_CA_CERT=''; WIFI_USER_CERT=''; WIFI_ANONYMOUS_IDENTITY=''
   5.262 +					fi
   5.263 +					[ -n "$WIFI_CA_CERT" ] && echo -e "\tca_cert=\"$WIFI_CA_CERT\""
   5.264 +					[ -n "$WIFI_CLIENT_CERT" ] && echo -e "\tclient_cert=\"$WIFI_CLIENT_CERT\""
   5.265 +					[ -n "$WIFI_IDENTITY" ] && echo -e "\tidentity=\"$WIFI_IDENTITY\""
   5.266 +					[ -n "$WIFI_ANONYMOUS_IDENTITY" ] && echo -e "\tanonymous_identity=\"$WIFI_ANONYMOUS_IDENTITY\""
   5.267 +					[ -n "$WIFI_KEY" ] && echo -e "\tpassword=\"$WIFI-KEY\""
   5.268 +					[ -n "$WIFI_PHASE2" ] && echo -e "\tphase2=\"auth=$WIFI_PHASE2\""
   5.269 +				} >> $WPA_CONF
   5.270 +				start_wpa_supplicant '802.1x EAP' ;;
   5.271 +
   5.272 +			xANY)
   5.273 +				cat >> $WPA_CONF <<EOT
   5.274  	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
   5.275  	group=CCMP TKIP WEP104 WEP40
   5.276  	pairwise=CCMP TKIP
   5.277  	psk="$WIFI_KEY"
   5.278 -	priority=5
   5.279 +	password="$WIFI_KEY"
   5.280 +	priority=$PRIORITY
   5.281  }
   5.282  EOT
   5.283 -				echo "Starting wpa_supplicant for any key type..."
   5.284 -				wpa_supplicant -B -W -c/etc/wpa/wpa.conf \
   5.285 -					-D$WPA_DRIVER -i$WIFI_INTERFACE ;;
   5.286 +				start_wpa_supplicant 'any key type' ;;
   5.287 +
   5.288  		esac
   5.289  		INTERFACE=$WIFI_INTERFACE
   5.290  	fi
   5.291  }
   5.292  
   5.293 +
   5.294  # WPA DHCP script
   5.295 +
   5.296  wpa() {
   5.297  	wpa_cli -a"/etc/init.d/wpa_action.sh" -B
   5.298  }
   5.299  
   5.300 -# For a dynamic IP with DHCP.
   5.301 +
   5.302 +# For a dynamic IP with DHCP
   5.303 +
   5.304  dhcp() {
   5.305 -	if [ "$DHCP" = "yes" ]  ; then
   5.306 +	if [ "$DHCP" == 'yes' ]; then
   5.307  		echo "Starting udhcpc client on: $INTERFACE..."
   5.308 -		# Is wpa wireless && wpa_ctrl_open interface up ?
   5.309 -		if [ -d /var/run/wpa_supplicant ] && [ "$WIFI" = "yes" ]; then
   5.310 +		# Is wpa wireless && wpa_ctrl_open interface up?
   5.311 +		if [ -d /var/run/wpa_supplicant ] && [ "$WIFI" == 'yes' ]; then
   5.312  			wpa
   5.313 -		else # fallback on udhcpc: wep, eth
   5.314 +		else
   5.315 +			# fallback on udhcpc: wep, eth
   5.316  			/sbin/udhcpc -b -T 1 -A 12 -i $INTERFACE -p \
   5.317 -			/var/run/udhcpc.$INTERFACE.pid
   5.318 +				/var/run/udhcpc.$INTERFACE.pid
   5.319  		fi
   5.320  	fi
   5.321  }
   5.322  
   5.323 -# For a static IP.
   5.324 +
   5.325 +# For a static IP
   5.326 +
   5.327  static_ip() {
   5.328 -	if [ "$STATIC" = "yes" ] ; then
   5.329 +	if [ "$STATIC" == 'yes' ]; then
   5.330  		echo "Configuring static IP on $INTERFACE: $IP..."
   5.331  		if [ -n "$BROADCAST" ]; then
   5.332  			/sbin/ifconfig $INTERFACE $IP netmask $NETMASK broadcast $BROADCAST up
   5.333  		else
   5.334  			/sbin/ifconfig $INTERFACE $IP netmask $NETMASK up
   5.335  		fi
   5.336 -		
   5.337 +
   5.338  		# Use ip to set gateways if iproute.conf exists
   5.339  		if [ -f /etc/iproute.conf ]; then
   5.340 -		    while read line
   5.341 -			do
   5.342 +			while read line; do
   5.343  				ip route add $line
   5.344  			done < /etc/iproute.conf
   5.345  		else
   5.346  			/sbin/route add default gateway $GATEWAY
   5.347  		fi
   5.348 -		
   5.349 +
   5.350  		# wpa_supplicant waits for wpa_cli
   5.351  		[ -d /var/run/wpa_supplicant ] && wpa_cli -B
   5.352 -		
   5.353 -		# Multi-DNS server in $DNS_SERVER.
   5.354 +
   5.355 +		# Multi-DNS server in $DNS_SERVER
   5.356  		/bin/mv /etc/resolv.conf /tmp/resolv.conf.$$
   5.357 -		for NS in $DNS_SERVER
   5.358 -		do
   5.359 -			echo "nameserver $NS" >> /etc/resolv.conf
   5.360 -		done
   5.361 -		if [ ! -z $DOMAIN ];then
   5.362 -		    echo "search $DOMAIN" >> /etc/resolv.conf
   5.363 -		fi
   5.364 +		{
   5.365 +			printf 'nameserver %s\n' $DNS_SERVER			# Multiple allowed
   5.366 +			[ -n "$DOMAIN" ] && echo "search $DOMAIN"
   5.367 +		} >> /etc/resolv.conf
   5.368  		for HELPER in /etc/ipup.d/*; do
   5.369  			[ -x $HELPER ] && $HELPER $INTERFACE $DNS_SERVER
   5.370  		done
   5.371  	fi
   5.372  }
   5.373  
   5.374 -# stopping everything
   5.375 +
   5.376 +# Stopping everything
   5.377 +
   5.378  stop() {
   5.379 -	echo "stopping all interfaces"
   5.380 +	echo 'Stopping all interfaces'
   5.381  	ifconfig $INTERFACE down
   5.382  	ifconfig $WIFI_INTERFACE down
   5.383  
   5.384 -	echo "Killing all daemons"
   5.385 +	echo 'Killing all daemons'
   5.386  	killall udhcpc
   5.387  	killall wpa_supplicant 2>/dev/null
   5.388  
   5.389 -	if iwconfig $WIFI_INTERFACE | fgrep -q "Tx-Power"; then
   5.390 -		echo "Shutting down wifi card"
   5.391 +	if iwconfig $WIFI_INTERFACE | fgrep -q 'Tx-Power'; then
   5.392 +		echo 'Shutting down Wi-Fi card'
   5.393  		iwconfig $WIFI_INTERFACE txpower off
   5.394  	fi
   5.395  }
   5.396  
   5.397 +
   5.398  start() {
   5.399  	eth
   5.400  	wifi
   5.401  	dhcp
   5.402  	static_ip
   5.403 -	# change default lxpanel panel iface
   5.404 +	reconnect_wifi_network
   5.405 +
   5.406 +	# change default LXPanel panel iface
   5.407  	if [ -f /etc/lxpanel/default/panels/panel ]; then
   5.408 -		sed -i "s/iface=.*/iface=$INTERFACE/" \
   5.409 -			/etc/lxpanel/default/panels/panel
   5.410 +		sed -i "s/iface=.*/iface=$INTERFACE/" /etc/lxpanel/default/panels/panel
   5.411  	fi
   5.412  }
   5.413  
   5.414 -# looking for arguments:
   5.415 -if [ -z "$1" ]; then
   5.416 -	boot
   5.417 -	start
   5.418 -else
   5.419 -	case $1 in
   5.420 -		start)
   5.421 -			start ;;
   5.422 -		stop)
   5.423 -			stop ;;
   5.424 -		restart)
   5.425 -			stop
   5.426 -			start ;;
   5.427 -		*)
   5.428 -			echo ""
   5.429 -			echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
   5.430 -			echo ""
   5.431 -			echo -e "	Default configuration file is \033[1m/etc/network.conf\033[0m"
   5.432 -			echo -e "	You can specify another configuration file in the second argument:"
   5.433 -			echo -e "	\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart] file.conf"
   5.434 -			echo "" ;;
   5.435 -	esac
   5.436 -fi
   5.437 +
   5.438 +# Looking for arguments:
   5.439 +
   5.440 +case "$1" in
   5.441 +	'')
   5.442 +		boot; start ;;
   5.443 +	start)
   5.444 +		start ;;
   5.445 +	stop)
   5.446 +		stop ;;
   5.447 +	restart)
   5.448 +		stop; sleep 2; start ;;
   5.449 +	*)
   5.450 +		cat <<EOT
   5.451 +
   5.452 +$(boldify 'Usage:') /etc/init.d/$(basename $0) [start|stop|restart]
   5.453 +
   5.454 +Default configuration file is $(boldify '/etc/network.conf')
   5.455 +You can specify another configuration file in the second argument:
   5.456 +/etc/init.d/$(basename $0) [start|stop|restart] file.conf
   5.457 +
   5.458 +EOT
   5.459 +		;;
   5.460 +esac
     6.1 --- a/etc/init.d/rc.shutdown	Sun Mar 22 19:30:39 2015 +0100
     6.2 +++ b/etc/init.d/rc.shutdown	Mon Mar 23 02:01:21 2015 +0200
     6.3 @@ -8,7 +8,7 @@
     6.4  log=/var/log/slitaz/shutdown.log
     6.5  
     6.6  # Clear and quiet shutdown
     6.7 -clear && echo "System is going down for reboot or halt." > $log
     6.8 +clear; echo 'System is going down for reboot or halt.' > $log
     6.9  uptime >> $log
    6.10  
    6.11  # Store last alsa settings.
    6.12 @@ -17,8 +17,7 @@
    6.13  fi
    6.14  
    6.15  # Stop all daemons started at boot time.
    6.16 -for daemon in $RUN_DAEMONS
    6.17 -do
    6.18 +for daemon in $RUN_DAEMONS; do
    6.19  	if [ -x /etc/init.d/$daemon ]; then
    6.20  		/etc/init.d/$daemon stop >> $log
    6.21  	fi
     7.1 --- a/etc/init.d/rcS	Sun Mar 22 19:30:39 2015 +0100
     7.2 +++ b/etc/init.d/rcS	Mon Mar 23 02:01:21 2015 +0200
     7.3 @@ -17,28 +17,31 @@
     7.4  
     7.5  readonly)
     7.6  
     7.7 -colorize 34 "Processing: /etc/init.d/rcS..."
     7.8 +colorize 34 'Processing: /etc/init.d/rcS...'
     7.9  
    7.10  # Mount /proc
    7.11 -echo -n "Mounting proc filesystem on /proc"
    7.12 +echo -n 'Mounting proc filesystem on /proc'
    7.13  mount proc && status
    7.14  
    7.15  # Trigger Udev and handle hotplug events
    7.16  if [ "$UDEV" == "yes" ]; then
    7.17 -	echo -n "Mounting devtmpfs filesystem on: /dev"
    7.18 +	echo -n 'Mounting devtmpfs filesystem on: /dev'
    7.19  	mount -t devtmpfs devtmpfs /dev
    7.20  	status
    7.21 -	echo "Starting udev daemon..."
    7.22 +
    7.23 +	echo 'Starting udev daemon...'
    7.24  	udevd --daemon 2>/dev/null
    7.25 -	echo "Udevadm requesting events from the Kernel..."
    7.26 +
    7.27 +	echo 'Udevadm requesting events from the Kernel...'
    7.28  	udevadm trigger
    7.29 -	echo "Udevadm waiting for the event queue to finish..."
    7.30 +
    7.31 +	echo 'Udevadm waiting for the event queue to finish...'
    7.32  	udevadm settle --timeout=120
    7.33  	# Disable hotplug helper since udevd listen to netlink
    7.34 -	echo "" > /proc/sys/kernel/hotplug
    7.35 +	echo '' > /proc/sys/kernel/hotplug
    7.36  else
    7.37 -	echo -n "Executing mdev -s to populate /dev..."
    7.38 -	mdev -s && echo "mdev" > /proc/sys/kernel/hotplug
    7.39 +	echo -n 'Executing mdev -s to populate /dev...'
    7.40 +	mdev -s && echo 'mdev' > /proc/sys/kernel/hotplug
    7.41  	status
    7.42  fi
    7.43  
    7.44 @@ -54,31 +57,31 @@
    7.45  fi
    7.46  
    7.47  # Remount rootfs rw.
    7.48 -echo "Remounting rootfs read/write..."
    7.49 +echo 'Remounting rootfs read/write...'
    7.50  mount -o remount,rw /
    7.51  sync	# ensure rw state
    7.52  
    7.53  # Mount filesystems in /etc/fstab.
    7.54 -echo "Mounting filesystems in fstab..."
    7.55 +echo 'Mounting filesystems in fstab...'
    7.56  mount -a
    7.57  ;;
    7.58  
    7.59 +
    7.60  readwrite)
    7.61  
    7.62  # Be quiet
    7.63 -echo "0 0 0 0" > /proc/sys/kernel/printk
    7.64 +echo '0 0 0 0' > /proc/sys/kernel/printk
    7.65  
    7.66  # Store boot messages to log files.
    7.67  dmesg > /var/log/dmesg.log &
    7.68  
    7.69  # Parse cmdline args for earlier boot options. All other boot options
    7.70  # are in /etc/init./bootopts.sh.
    7.71 -echo -n "Searching for early boot options..."
    7.72 -for opt in $(cat /proc/cmdline)
    7.73 -do
    7.74 +echo -n 'Searching for early boot options...'
    7.75 +for opt in $(cat /proc/cmdline); do
    7.76  	case $opt in
    7.77  		modprobe=*)
    7.78 -			export MODPROBE="yes" ;;
    7.79 +			export MODPROBE='yes' ;;
    7.80  		config=*)
    7.81  			export CONFIG=${opt#config=} ;;
    7.82  		screen=*)
    7.83 @@ -91,14 +94,14 @@
    7.84  
    7.85  # Clean up the system and set up tmp dirs. */run/* are tmpfs so they are 
    7.86  # cleaned up at shutdown.
    7.87 -if [ "$CLEAN_UP_SYSTEM" = "yes" ]; then
    7.88 -	echo -n "Cleaning up the system..."
    7.89 +if [ "$CLEAN_UP_SYSTEM" == 'yes' ]; then
    7.90 +	echo -n 'Cleaning up the system...'
    7.91  	rm -rf /tmp
    7.92  	mkdir -p /tmp/.X11-unix /tmp/.ICE-unix
    7.93  	chmod -R 1777 /tmp
    7.94  	status
    7.95  else
    7.96 -	echo "System clean up is disabled in: /etc/rcS.conf"
    7.97 +	echo 'System clean up is disabled in: /etc/rcS.conf'
    7.98  fi
    7.99  
   7.100  # Handle kernel cmdline parameter modprobe=<module_list>
   7.101 @@ -118,7 +121,7 @@
   7.102  	SCRIPT=${CONFIG#*,}
   7.103  	echo "Probing $DEVICE... "
   7.104  	if ! mount -r $DEVICE /mnt; then
   7.105 -		if echo $DEVICE | grep -Eq "/dev/sd|UUID=|LABEL="; then
   7.106 +		if echo $DEVICE | grep -Eq '/dev/sd|UUID=|LABEL='; then
   7.107  			USBDELAY=$(cat /sys/module/usb_storage/parameters/delay_use)
   7.108  			USBDELAY=$((1+$USBDELAY))
   7.109  			echo "$DEVICE is potentially a USB device: sleep for $USBDELAY seconds"
   7.110 @@ -138,20 +141,20 @@
   7.111  
   7.112  # Mount /proc/bus/usb
   7.113  if [ -d /proc/bus/usb ]; then
   7.114 -	echo -n "Mounting usbfs filesystem on: /proc/bus/usb"
   7.115 +	echo -n 'Mounting usbfs filesystem on: /proc/bus/usb'
   7.116  	mount -t usbfs usbfs /proc/bus/usb
   7.117  	status
   7.118  fi
   7.119  
   7.120  # Start syslogd and klogd
   7.121 -echo -n "Starting system log daemon: syslogd..."
   7.122 +echo -n 'Starting system log daemon: syslogd...'
   7.123  syslogd -s $SYSLOGD_ROTATED_SIZE && status
   7.124 -echo -n "Starting kernel log daemon: klogd..."
   7.125 +echo -n 'Starting kernel log daemon: klogd...'
   7.126  klogd && status
   7.127  
   7.128  # Load all modules listed in config file
   7.129  if [ "$LOAD_MODULES" ]; then
   7.130 -	colorize 33 "Loading Kernel modules..."
   7.131 +	colorize 33 'Loading Kernel modules...'
   7.132  	for mod in $LOAD_MODULES; do
   7.133  		echo -n "Loading module: $mod"
   7.134  		modprobe $mod
   7.135 @@ -167,8 +170,8 @@
   7.136  
   7.137  # Call udevadm trigger to ensure /dev is fully populated now that all
   7.138  # modules are loaded.
   7.139 -if [ "$UDEV" = "yes" ]; then
   7.140 -	echo -n "Triggering udev events: --action=add"
   7.141 +if [ "$UDEV" == 'yes' ]; then
   7.142 +	echo -n 'Triggering udev events: --action=add'
   7.143  	udevadm trigger --action=add
   7.144  	status
   7.145  fi
   7.146 @@ -182,13 +185,13 @@
   7.147  # Start X session. Dbus must be started before Xorg and other daemons. 
   7.148  # We started it here because X is run before RUN_DAEMONS. Sleep, in 
   7.149  # some in live mode we boot too fast and X can't initialize.
   7.150 -if [ "$SCREEN" != "text" ] && [ "$LOGIN_MANAGER" ] &&
   7.151 +if [ "$SCREEN" != 'text' ] && [ "$LOGIN_MANAGER" ] &&
   7.152  	[ -x /usr/bin/tazx ] && [ -s /etc/slitaz/applications.conf ] &&
   7.153  	[ -x "/etc/init.d/$LOGIN_MANAGER" ]; then
   7.154 -	colorize 36 "Starting X environment..."
   7.155 +	colorize 36 'Starting X environment...'
   7.156  	# We need Xorg 40-Keyboard.conf and SliTaz applications.conf
   7.157 -	if [ ! -s "/etc/X11/xorg.conf.d/40-Keyboard.conf" ]; then
   7.158 -		echo "Configuring Xorg server..." && HOME="/root" 
   7.159 +	if [ ! -s '/etc/X11/xorg.conf.d/40-Keyboard.conf' ]; then
   7.160 +		echo 'Configuring Xorg server...' && HOME='/root'
   7.161  		tazx init
   7.162  	fi
   7.163  	/etc/init.d/dbus start
   7.164 @@ -205,7 +208,7 @@
   7.165  fi
   7.166  
   7.167  # Back to a verbose mode
   7.168 -(sleep 6 && echo "7 4 1 7" > /proc/sys/kernel/printk) &
   7.169 +(sleep 6 && echo '7 4 1 7' > /proc/sys/kernel/printk) &
   7.170  
   7.171  if [ "$MESSAGE" ]; then
   7.172  	newline
     8.1 --- a/etc/init.d/system.sh	Sun Mar 22 19:30:39 2015 +0100
     8.2 +++ b/etc/init.d/system.sh	Mon Mar 23 02:01:21 2015 +0200
     8.3 @@ -10,13 +10,11 @@
     8.4  . /etc/rcS.conf
     8.5  
     8.6  # Parse cmdline args for boot options (See also rcS and bootopts.sh).
     8.7 -XARG=""
     8.8 -for opt in $(cat /proc/cmdline)
     8.9 -do
    8.10 +XARG=''
    8.11 +for opt in $(cat /proc/cmdline); do
    8.12  	case $opt in
    8.13  		console=*)
    8.14 -			sed -i "s/tty1/${opt#console=}/g;/^tty[2-9]::/d" \
    8.15 -				/etc/inittab ;;
    8.16 +			sed -i "s/tty1/${opt#console=}/g;/^tty[2-9]::/d" /etc/inittab ;;
    8.17  		sound=*)
    8.18  			DRIVER=${opt#sound=} ;;
    8.19  		xarg=*)
    8.20 @@ -27,9 +25,9 @@
    8.21  done
    8.22  
    8.23  # Locale config
    8.24 -if [ ! -s "/etc/locale.conf" ]; then
    8.25 -	echo "Setting system locale to: POSIX (English)"
    8.26 -	echo -e "LANG=POSIX\nLC_ALL=POSIX" > /etc/locale.conf
    8.27 +if [ ! -s '/etc/locale.conf' ]; then
    8.28 +	echo 'Setting system locale to: POSIX (English)'
    8.29 +	echo -e 'LANG=POSIX\nLC_ALL=POSIX' > /etc/locale.conf
    8.30  fi
    8.31  . /etc/locale.conf
    8.32  echo -n "Setting system locale: $LANG"
    8.33 @@ -37,9 +35,9 @@
    8.34  . /lib/libtaz.sh && status
    8.35  
    8.36  # Keymap config: Default to us in live mode if kmap= was not used.
    8.37 -if [ ! -s "/etc/keymap.conf" ]; then
    8.38 -	echo "Setting system keymap to: us (USA)"
    8.39 -	echo "us" > /etc/keymap.conf
    8.40 +if [ ! -s '/etc/keymap.conf' ]; then
    8.41 +	echo 'Setting system keymap to: us (USA)'
    8.42 +	echo 'us' > /etc/keymap.conf
    8.43  fi
    8.44  kmap=$(cat /etc/keymap.conf)
    8.45  echo -n "Loading console keymap: $kmap"
    8.46 @@ -48,14 +46,14 @@
    8.47  
    8.48  # Timezone config: Set timezone using the keymap config for fr, be, fr_CH
    8.49  # and ca with Montreal.
    8.50 -if [ ! -s "/etc/TZ" ]; then
    8.51 +if [ ! -s '/etc/TZ' ]; then
    8.52  	case "$kmap" in
    8.53  		fr-latin1|be-latin1)
    8.54 -			echo "Europe/Paris" > /etc/TZ ;;
    8.55 +			echo 'Europe/Paris' > /etc/TZ ;;
    8.56  		fr_CH-latin1|de_CH-latin1)
    8.57 -			echo "Europe/Zurich" > /etc/TZ ;;
    8.58 -		cf) echo "America/Montreal" > /etc/TZ ;;
    8.59 -		*) echo "UTC" > /etc/TZ ;;
    8.60 +			echo 'Europe/Zurich' > /etc/TZ ;;
    8.61 +		cf) echo 'America/Montreal' > /etc/TZ ;;
    8.62 +		*) echo 'UTC' > /etc/TZ ;;
    8.63  	esac
    8.64  fi
    8.65  
    8.66 @@ -71,7 +69,7 @@
    8.67  	done
    8.68  fi
    8.69  if grep -q swap /etc/fstab; then
    8.70 -	echo -n "Activating swap memory..."
    8.71 +	echo -n 'Activating swap memory...'
    8.72  	swapon -a && status
    8.73  fi
    8.74  
    8.75 @@ -86,10 +84,10 @@
    8.76  if [ -n "$DRIVER" ]; then
    8.77  	case "$DRIVER" in
    8.78  		no)
    8.79 -			echo -n "Removing all sound kernel modules..."
    8.80 +			echo -n 'Removing all sound kernel modules...'
    8.81  			rm -rf /lib/modules/$(uname -r)/kernel/sound
    8.82  			status
    8.83 -			echo -n "Removing all sound packages..."
    8.84 +			echo -n 'Removing all sound packages...'
    8.85  			for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    8.86  				pkg=${i#/var/lib/tazpkg/installed/}
    8.87  				echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    8.88 @@ -99,7 +97,7 @@
    8.89  			done
    8.90  			status ;;
    8.91  		noconf)
    8.92 -			echo "Sound configuration was disabled from cmdline..." ;;
    8.93 +			echo 'Sound configuration was disabled from cmdline...' ;;
    8.94  		*)
    8.95  			if [ -x /usr/sbin/soundconf ]; then
    8.96  				echo "Using sound kernel module $DRIVER..."
    8.97 @@ -110,12 +108,12 @@
    8.98  elif [ -d /proc/asound ]; then
    8.99  	if [ -s /var/lib/alsa/asound.state ]; then
   8.100  		# Restore sound config for installed system
   8.101 -		echo "Restoring last alsa configuration..."
   8.102 +		echo 'Restoring last alsa configuration...'
   8.103  		(sleep 2; alsactl restore) &
   8.104  	else
   8.105  		# Initialize sound card
   8.106  		alsactl init
   8.107  	fi
   8.108  else
   8.109 -	echo "WARNING: Unable to configure sound card"
   8.110 +	echo 'WARNING: Unable to configure sound card'
   8.111  fi
     9.1 --- a/etc/init.d/wpa_action.sh	Sun Mar 22 19:30:39 2015 +0100
     9.2 +++ b/etc/init.d/wpa_action.sh	Mon Mar 23 02:01:21 2015 +0200
     9.3 @@ -3,9 +3,9 @@
     9.4  
     9.5  # For a dynamic IP with DHCP.
     9.6  if [ "$2" = "CONNECTED" ]; then
     9.7 -     [ -f /var/run/udhcpc.$INTERFACE.pid] && killall udhcpc
     9.8 +	[ -f /var/run/udhcpc.$INTERFACE.pid] && killall udhcpc
     9.9  	/sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid
    9.10  elif [ "$2" = "DISCONNECTED" ]; then
    9.11 -   	/sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid
    9.12 +	/sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid
    9.13  fi
    9.14  
    10.1 --- a/etc/network.conf	Sun Mar 22 19:30:39 2015 +0100
    10.2 +++ b/etc/network.conf	Mon Mar 23 02:01:21 2015 +0200
    10.3 @@ -2,6 +2,8 @@
    10.4  # Config file used by: /etc/init.d/network.sh
    10.5  #
    10.6  
    10.7 +NETWORK_CONF_VERSION="2"
    10.8 +
    10.9  # Set default interface.
   10.10  INTERFACE="eth0"
   10.11  
   10.12 @@ -9,7 +11,11 @@
   10.13  # Enable/disable DHCP client at boot time.
   10.14  DHCP="yes"
   10.15  
   10.16 -# Static IP address.
   10.17 +
   10.18 +#
   10.19 +# Settings only for static IP address.
   10.20 +#
   10.21 +
   10.22  # Enable/disable static IP at boot time.
   10.23  STATIC="no"
   10.24  
   10.25 @@ -29,20 +35,71 @@
   10.26  # Set DNS server for a static IP.
   10.27  DNS_SERVER="192.168.0.1"
   10.28  
   10.29 -# Wifi connection.
   10.30 +
   10.31 +#
   10.32 +# Wi-Fi settings.
   10.33 +#
   10.34 +
   10.35  # Enable/disable wireless connection at boot time.
   10.36  WIFI="no"
   10.37  
   10.38 -# Wifi interface (iwconfig) and ESSID.
   10.39 +# Set "yes" if you don't want to store networks you're already connected.
   10.40 +WIFI_BLANK_NETWORKS=""
   10.41 +
   10.42 +
   10.43 +#
   10.44 +# Wi-Fi settings for iwconfig.
   10.45 +#
   10.46 +
   10.47 +# Wi-Fi interface. It can auto-search interface if value below is fail.
   10.48  WIFI_INTERFACE="wlan0"
   10.49 +
   10.50 +# WPA driver; default is "wext" (Wireless Extension).
   10.51 +WIFI_WPA_DRIVER="wext"
   10.52 +
   10.53 +# Set the operating mode of the device. The mode can be "Ad-Hoc", "Managed",
   10.54 +#  "Master", "Repeater", "Secondary", "Monitor" or "Auto".
   10.55 +WIFI_MODE="managed"
   10.56 +
   10.57 +# Set the operating channel in the device. Empty by default.
   10.58 +WIFI_CHANNEL=""
   10.59 +
   10.60 +# Force the card to register to the Access Point given by the address, if it
   10.61 +#  possible. Empty by default to automatic mode.
   10.62 +WIFI_AP=""
   10.63 +
   10.64 +
   10.65 +#
   10.66 +# Wi-Fi settings for wpa_supplicant (for given network).
   10.67 +#
   10.68 +
   10.69 +# SSID (network name)
   10.70  WIFI_ESSID="any"
   10.71 +
   10.72 +# BSSID (optional), use this block to associate with the AP
   10.73 +WIFI_BSSID=""
   10.74 +
   10.75 +# Wi-Fi security. Empty ("") for open network; "ANY" for trying many methods;
   10.76 +# "WEP" for WEP; "WPA" for WPA/WPA2-PSK; "EAP" for 802.1x EAP.
   10.77 +WIFI_KEY_TYPE="any"
   10.78 +
   10.79 +# Password for WEP, WPA, EAP, WAPI, and ANY; both in ASCII or HEX form.
   10.80  WIFI_KEY=""
   10.81 -WIFI_KEY_TYPE="any"
   10.82 -WIFI_AP=""
   10.83 -WIFI_MODE="managed"
   10.84 -WIFI_CHANNEL=""
   10.85 -WPA_DRIVER=""
   10.86  
   10.87 -# Wifi network requiring a user and password
   10.88 +# Method for EAP: "PEAP", "TLS", "TTLS", "PWD".
   10.89 +WIFI_EAP_METHOD=""
   10.90 +
   10.91 +# File path to CA certificate file (PEM/DER).
   10.92 +WIFI_CA_CERT=""
   10.93 +
   10.94 +# File path to client certificate file (PEM/DER).
   10.95 +WIFI_CLIENT_CERT=""
   10.96 +
   10.97 +# Identity string for EAP.
   10.98  WIFI_IDENTITY=""
   10.99 -WIFI_PASSWORD=""
  10.100 +
  10.101 +# Anonymous identity string for EAP.
  10.102 +WIFI_ANONYMOUS_IDENTITY=""
  10.103 +
  10.104 +# Inner authentication parameters: "", "PAP", "MSCHAP", "MSCHAPV2", "GTC".
  10.105 +WIFI_PHASE2=""
    11.1 --- a/init	Sun Mar 22 19:30:39 2015 +0100
    11.2 +++ b/init	Mon Mar 23 02:01:21 2015 +0200
    11.3 @@ -106,7 +106,7 @@
    11.4  {
    11.5  for i in $@; do
    11.6  	echo "Loading module: $i"
    11.7 -	modprobe $i 2>/dev/null || busybox insmod $(find /lib/modules|sed "/$i.ko/!dq") 
    11.8 +	modprobe $i 2>/dev/null || busybox insmod $(find /lib/modules|sed "/$i.ko/!dq")
    11.9  done
   11.10  }
   11.11  
   11.12 @@ -149,14 +149,14 @@
   11.13  
   11.14  ldraid()
   11.15  {
   11.16 -while read l
   11.17 -do case "$l" in
   11.18 -*raid10*)	mod raid10;;
   11.19 -*raid0*)	mod raid0;;
   11.20 -*raid1*)	mod raid1;;
   11.21 -*raid*)		mod raid456;;
   11.22 -*mirror*)	mod dm-mirror
   11.23 -esac
   11.24 +while read l; do
   11.25 +	case "$l" in
   11.26 +		*raid10*)	mod raid10;;
   11.27 +		*raid0*)	mod raid0;;
   11.28 +		*raid1*)	mod raid1;;
   11.29 +		*raid*)		mod raid456;;
   11.30 +		*mirror*)	mod dm-mirror;;
   11.31 +	esac
   11.32  done
   11.33  }
   11.34  
   11.35 @@ -173,28 +173,28 @@
   11.36  fi
   11.37  got modprobe && mod ${root//,/ }
   11.38  [ -d /proc/sys/dev/cdrom ] &&
   11.39 -ln -s $(sed '/name/!d;s/.*:[^a-z]*//' /proc/sys/dev/cdrom/info) /dev/cdrom
   11.40 -if use dmraid
   11.41 -then	dmraid -s|sed '/^type/!ds/.*: *//'|ldraid
   11.42 +	ln -s $(sed '/name/!d;s/.*:[^a-z]*//' /proc/sys/dev/cdrom/info) /dev/cdrom
   11.43 +if use dmraid; then
   11.44 +	dmraid -s | sed '/^type/!ds/.*: *//' | ldraid
   11.45  	[ ${root:0:4} = /dev ] ||
   11.46 -	root=/dev/mapper/$(dmraid -s|sed '/^name/!ds/.*: *//')p${root#p}
   11.47 +		root=/dev/mapper/$(dmraid -s|sed '/^name/!ds/.*: *//')p${root#p}
   11.48  	dmraid -ay
   11.49  fi
   11.50 -if use softraid
   11.51 -then	mdadm -E -s -c partitions>/etc/mdadm.conf
   11.52 +if use softraid; then
   11.53 +	mdadm -E -s -c partitions > /etc/mdadm.conf
   11.54  	grep -qs " $root " /etc/mdadm.conf ||
   11.55 -	root=$(awk '/dev.md/{print $2;exit}'</etc/mdadm.conf)
   11.56 -	grep level=raid /etc/mdadm.conf|ldraid
   11.57 -	for i in 1 2 3 4 5 6 7 8 9
   11.58 -	do	sleep $i
   11.59 +		root=$(awk '/dev.md/{print $2;exit}' < /etc/mdadm.conf)
   11.60 +	grep level=raid /etc/mdadm.conf | ldraid
   11.61 +	for i in 1 2 3 4 5 6 7 8 9; do
   11.62 +		sleep $i
   11.63  		mdadm -A -s
   11.64  		grep -qs ': act' /proc/mdstat && break
   11.65  	done
   11.66  	lvm /etc/mdadm.conf
   11.67  fi
   11.68  lvm
   11.69 -if got mount
   11.70 -then	dev=$root
   11.71 +if got mount; then
   11.72 +	dev=$root
   11.73  	x=$(blkid|grep $dev|sed 's/:.*//;q')
   11.74  	root=${x:-$dev}
   11.75  	[ "$dev" = "$root" ] || dev="$root ($dev)"
   11.76 @@ -208,8 +208,8 @@
   11.77  got bindfs && echo "Bind ${root/,/ to }..." &&
   11.78  	busybox mount --bind /mnt/${root%,*} /mnt/${root/,//}
   11.79  arg cryptoroot= && try
   11.80 -if use subroot
   11.81 -then	cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so /usr/sbin/chroot | sed\
   11.82 +if use subroot; then
   11.83 +	cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so /usr/sbin/chroot | sed\
   11.84  		's|.*=> \(/lib/l[^ ]*\).*|\1|;/^\//!d') /usr/sbin/chroot /run
   11.85  	r=$root/run
   11.86  	quit $r "export LD_LIBRARY_PATH=$r:/lib"\
   11.87 @@ -223,9 +223,9 @@
   11.88  root=90%
   11.89  got rootfssize
   11.90  [ $(busybox free|busybox awk '/Mem:/{print int(($4*100)/$3)}') -ge $r ] &&
   11.91 -busybox mount -t tmpfs -o size=$root tmpfs /mnt &&
   11.92 -for i in $(ls -ar /)
   11.93 -do	case "$i" in
   11.94 +	busybox mount -t tmpfs -o size=$root tmpfs /mnt &&
   11.95 +for i in $(ls -ar /); do
   11.96 +	case "$i" in
   11.97  	.*|cdrom)	;;
   11.98  	mnt|proc|sys)	mkdir /mnt/$i;;
   11.99  	usr|var|rootfs*) mv /$i /mnt;;
  11.100 @@ -244,8 +244,8 @@
  11.101  o=
  11.102  p=
  11.103  c=/mnt/.cdrom
  11.104 -if [ -z "$(ls /mnt/rootfs* 2>/dev/null)" ]
  11.105 -then	root=/dev/cdrom/fs
  11.106 +if [ -z "$(ls /mnt/rootfs* 2>/dev/null)" ]; then
  11.107 +	root=/dev/cdrom/fs
  11.108  	got rodev
  11.109  	mkdir -p $c /mnt$c /mnt/.rw$c
  11.110  	mnt $c
  11.111 @@ -255,8 +255,8 @@
  11.112  fi
  11.113  l=0
  11.114  r=
  11.115 -got isofs || for i in /mnt$p/rootfs?*.gz
  11.116 -do	fs=${i#*root}
  11.117 +got isofs || for i in /mnt$p/rootfs?*.gz; do
  11.118 +	fs=${i#*root}
  11.119  	r=$r:/mnt/.$fs
  11.120  	mkdir -p /mnt/.rw/mnt/.$fs /mnt/.$fs
  11.121  	losetup $o /dev/loop$l $i
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/usr/bin/bootlog	Mon Mar 23 02:01:21 2015 +0200
    12.3 @@ -0,0 +1,16 @@
    12.4 +#!/bin/sh
    12.5 +#
    12.6 +# Display SliTaz boot log messages
    12.7 +#
    12.8 +
    12.9 +catlog() {
   12.10 +	cat /var/log/dmesg.log /var/log/boot.log | sed "s/.\[3g.*\]R//"
   12.11 +}
   12.12 +
   12.13 +case "$1" in
   12.14 +	box) catlog | sed -e s'///'g -e s'/\[1;3[0-9]m//'g \
   12.15 +		-e s'/\[*.0G\[/ /'g -e s'/\[0;39m.*//'g | yad \
   12.16 +		--text-info --title="Boot Log" --window-icon=text-plain \
   12.17 +		--width=600 --height=400 --button=gtk-close:0 ;;
   12.18 +	*) catlog ;;
   12.19 +esac
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/usr/bin/rcSconf	Mon Mar 23 02:01:21 2015 +0200
    13.3 @@ -0,0 +1,62 @@
    13.4 +#!/bin/sh
    13.5 +#
    13.6 +# Update and clean-up /etc/rcS.conf
    13.7 +#
    13.8 +
    13.9 +# X is now started earlier by system.sh
   13.10 +up_daemons() {
   13.11 +	echo $RUN_DAEMONS | sed \
   13.12 +		-e s/dbus// -e s/hald// -e s/slim// -e s'/   //' -e s'/  //'
   13.13 +}
   13.14 +
   13.15 +case "$1" in
   13.16 +	up)
   13.17 +		[ $(id -u) != 0 ] && exit 0
   13.18 +		#check_root: broken gettext in libtaz.sh
   13.19 +		. /etc/rcS.conf
   13.20 +		cp -f /etc/rcS.conf /etc/slitaz/rcS.conf.bak
   13.21 +		echo "Updating: /etc/rcS.conf"
   13.22 +		cat > /etc/rcS.conf << EOT
   13.23 +# /etc/rcS.conf : Initial boot script configuration for SliTaz GNU/Linux
   13.24 +# Sourced by    : /etc/init.d/rcS
   13.25 +#
   13.26 +
   13.27 +# Use udev to populate /dev and handle hotplug events
   13.28 +UDEV="$UDEV"
   13.29 +
   13.30 +# Clean up the system removing all tmp and pid files
   13.31 +CLEAN_UP_SYSTEM="$CLEAN_UP_SYSTEM"
   13.32 +
   13.33 +# Filesystems to check integrity of at boot time. You should check the
   13.34 +# rootfs (where SliTaz is installed) and all partitions listed in fstab.
   13.35 +# Example: CHECK_FS="/dev/hda5 /dev/hdb1"
   13.36 +CHECK_FS="$CHECK_FS"
   13.37 +
   13.38 +# Syslogd: Max size (KB) before rotation
   13.39 +SYSLOGD_ROTATED_SIZE="$SYSLOGD_ROTATED_SIZE"
   13.40 +
   13.41 +# Kernel modules to load at boot time
   13.42 +LOAD_MODULES="$LOAD_MODULES"
   13.43 +
   13.44 +# X Login manager: slim or lxdm, empty to disable X
   13.45 +LOGIN_MANAGER="slim"
   13.46 +
   13.47 +# Initialization scripts to run at boot time. The local.sh script
   13.48 +# let you quickly add some local startup commands.
   13.49 +RUN_SCRIPTS="bootopts.sh system.sh network.sh local.sh"
   13.50 +
   13.51 +# Daemons to start at boot time. DBUS daemon is started before the
   13.52 +# login manager and from: /etc/init.d/system.sh
   13.53 +RUN_DAEMONS="$(up_daemons)"
   13.54 +
   13.55 +# Pre login message
   13.56 +MESSAGE="Welcome to your box"
   13.57 +EOT
   13.58 +		diff /etc/slitaz/rcS.conf.bak /etc/rcS.conf > \
   13.59 +			/etc/slitaz/rcS.conf.diff ;;
   13.60 +	show) less -E /etc/rcS.conf ;;
   13.61 +	show-diff) less -E /etc/slitaz/rcS.conf.diff ;;
   13.62 +	clean) rm -f /etc/slitaz/rcS.conf* ;;
   13.63 +	*) echo "Usage: $(basename $0) [up|show|show-diff|clean]" ;;
   13.64 +esac
   13.65 +exit 0
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/usr/share/applications/bootlog.desktop	Mon Mar 23 02:01:21 2015 +0200
    14.3 @@ -0,0 +1,10 @@
    14.4 +[Desktop Entry]
    14.5 +Type=Application
    14.6 +Name=Boot Log Viewer
    14.7 +Name[fr]=Log de démarrage
    14.8 +Name[pt]=Visualizar log de boot
    14.9 +Name[pt_BR]=Visualizar log de boot
   14.10 +Name[ru]=Журнал загрузки
   14.11 +Exec=bootlog box
   14.12 +Icon=text-plain
   14.13 +Categories=System;Monitor;
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/usr/share/slitaz/network.conf_migration	Mon Mar 23 02:01:21 2015 +0200
    15.3 @@ -0,0 +1,116 @@
    15.4 +# Migrate existing settings to a new format file
    15.5 +# Sourced and executed by /etc/init.d/network.sh
    15.6 +
    15.7 +if [ "$NETWORK_CONF_VERSION" != '2' ]; then
    15.8 +	echo "Moving old settings to $CONF.old"
    15.9 +	mv -f $CONF $CONF.old
   15.10 +
   15.11 +	echo "Migrate existing settings to a new format $CONF"
   15.12 +	cat > $CONF << EOT
   15.13 +# /etc/network.conf: SliTaz system wide networking configuration.
   15.14 +# Config file used by: /etc/init.d/network.sh
   15.15 +#
   15.16 +
   15.17 +NETWORK_CONF_VERSION="2"
   15.18 +
   15.19 +# Set default interface.
   15.20 +INTERFACE="$INTERFACE"
   15.21 +
   15.22 +# Dynamic IP address.
   15.23 +# Enable/disable DHCP client at boot time.
   15.24 +DHCP="$DHCP"
   15.25 +
   15.26 +
   15.27 +#
   15.28 +# Settings only for static IP address.
   15.29 +#
   15.30 +
   15.31 +# Enable/disable static IP at boot time.
   15.32 +STATIC="$STATIC"
   15.33 +
   15.34 +# Set IP address and netmask for a static IP.
   15.35 +IP="$IP"
   15.36 +NETMASK="$NETMASK"
   15.37 +
   15.38 +# Set broadcast address
   15.39 +BROADCAST="$BROADCAST"
   15.40 +
   15.41 +# Set route gateway for a static IP.
   15.42 +GATEWAY="$GATEWAY"
   15.43 +
   15.44 +# Set domain name
   15.45 +DOMAIN="$DOMAIN"
   15.46 +
   15.47 +# Set DNS server for a static IP.
   15.48 +DNS_SERVER="$DNS_SERVER"
   15.49 +
   15.50 +
   15.51 +#
   15.52 +# Wi-Fi settings.
   15.53 +#
   15.54 +
   15.55 +# Enable/disable wireless connection at boot time.
   15.56 +WIFI="$WIFI"
   15.57 +
   15.58 +# Set "yes" if you don't want to store networks you're already connected.
   15.59 +WIFI_BLANK_NETWORKS="$WIFI_BLANK_NETWORKS"
   15.60 +
   15.61 +
   15.62 +#
   15.63 +# Wi-Fi settings for iwconfig.
   15.64 +#
   15.65 +
   15.66 +# Wi-Fi interface. It can auto-search interface if value below is fail.
   15.67 +WIFI_INTERFACE="$WIFI_INTERFACE"
   15.68 +
   15.69 +# WPA driver; default is "wext" (Wireless Extension).
   15.70 +WIFI_WPA_DRIVER="$WIFI_WPA_DRIVER"
   15.71 +
   15.72 +# Set the operating mode of the device. The mode can be "Ad-Hoc", "Managed",
   15.73 +#  "Master", "Repeater", "Secondary", "Monitor" or "Auto".
   15.74 +WIFI_MODE="$WIFI_MODE"
   15.75 +
   15.76 +# Set the operating channel in the device. Empty by default.
   15.77 +WIFI_CHANNEL="$WIFI_CHANNEL"
   15.78 +
   15.79 +# Force the card to register to the Access Point given by the address, if it
   15.80 +#  possible. Empty by default to automatic mode.
   15.81 +WIFI_AP="$WIFI_AP"
   15.82 +
   15.83 +
   15.84 +#
   15.85 +# Wi-Fi settings for wpa_supplicant (for given network).
   15.86 +#
   15.87 +
   15.88 +# SSID (network name)
   15.89 +WIFI_ESSID="$WIFI_ESSID"
   15.90 +
   15.91 +# BSSID (optional), use this block to associate with the AP
   15.92 +WIFI_BSSID="$WIFI_BSSID"
   15.93 +
   15.94 +# Wi-Fi security. Empty ("") for open network; "ANY" for trying many methods;
   15.95 +# "WEP" for WEP; "WPA" for WPA/WPA2-PSK; "EAP" for 802.1x EAP.
   15.96 +WIFI_KEY_TYPE="$WIFI_KEY_TYPE"
   15.97 +
   15.98 +# Password for WEP, WPA, EAP, WAPI, and ANY; both in ASCII or HEX form.
   15.99 +WIFI_KEY="$WIFI_KEY"
  15.100 +
  15.101 +# Method for EAP: "PEAP", "TLS", "TTLS", "PWD".
  15.102 +WIFI_EAP_METHOD="$WIFI_EAP_METHOD"
  15.103 +
  15.104 +# File path to CA certificate file (PEM/DER).
  15.105 +WIFI_CA_CERT="$WIFI_CA_CERT"
  15.106 +
  15.107 +# File path to client certificate file (PEM/DER).
  15.108 +WIFI_CLIENT_CERT="$WIFI_CLIENT_CERT"
  15.109 +
  15.110 +# Identity string for EAP.
  15.111 +WIFI_IDENTITY="$WIFI_IDENTITY"
  15.112 +
  15.113 +# Anonymous identity string for EAP.
  15.114 +WIFI_ANONYMOUS_IDENTITY="$WIFI_ANONYMOUS_IDENTITY"
  15.115 +
  15.116 +# Inner authentication parameters: "", "PAP", "MSCHAP", "MSCHAPV2", "GTC".
  15.117 +WIFI_PHASE2="$WIFI_PHASE2"
  15.118 +EOT
  15.119 +fi