slitaz-boot-scripts rev 431

network.sh: fix errors in boot log: not even try to show notifications while Xorg is not running
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon May 23 13:45:07 2016 +0300 (2016-05-23)
parents 018eeb31a351
children ae63069a080f
files etc/init.d/network.sh
line diff
     1.1 --- a/etc/init.d/network.sh	Sat May 21 17:20:19 2016 +0200
     1.2 +++ b/etc/init.d/network.sh	Mon May 23 13:45:07 2016 +0300
     1.3 @@ -8,7 +8,7 @@
     1.4  . /etc/init.d/rc.functions
     1.5  
     1.6  CONF="${2:-/etc/network.conf}"
     1.7 -echo "Loading network settings from $CONF"
     1.8 +[ "$1" != 'netapplet' ] && echo "Loading network settings from $CONF"
     1.9  . "$CONF"
    1.10  
    1.11  
    1.12 @@ -21,7 +21,7 @@
    1.13  		interface="$INTERFACE"
    1.14  	fi
    1.15  
    1.16 -	for i in $(find ${XDG_CONFIG_HOME:-$HOME/.config}/lxpanel -name panel 2> /dev/null); do
    1.17 +	for i in $(find ${XDG_CONFIG_HOME:-$HOME/.config}/lxpanel -name panel 2>/dev/null); do
    1.18  		fgrep -q netstatus "$i" || continue
    1.19  		sed -i '/iface/s|=.*$|='$interface'|' "$i"
    1.20  	done
    1.21 @@ -58,11 +58,12 @@
    1.22  # Freedesktop notification
    1.23  
    1.24  notification() {
    1.25 +	ps aux 2>/dev/null | grep -q [X]org || return
    1.26  	# FIXME: this valid only for lxde-session
    1.27 -	local user="$(ps aux | grep [l]xde-session | awk 'END{print $2}')"
    1.28 +	local user="$(ps aux 2>/dev/null | grep [l]xde-session | awk 'END{print $2}')"
    1.29  	local icon="$1" rpid=''
    1.30  	[ -s "$npid" ] && rpid="-r $(cat $npid)"
    1.31 -	which notify-send > /dev/null &&
    1.32 +	which notify-send >/dev/null &&
    1.33  	su -c "notify-send $rpid -p -i $icon 'Network' \"$2\"" - $user | tail -n1 > $npid
    1.34  }
    1.35