slitaz-boot-scripts rev 475 tip
modified ps to work with busybox as well as with procps
author | Hans-G?nter Theisgen |
---|---|
date | Tue Jun 06 15:43:18 2023 +0100 (15 months ago) |
parents | 9a679d8916b6 |
children | |
files | etc/init.d/network.sh |
line diff
1.1 --- a/etc/init.d/network.sh Thu Mar 23 17:04:05 2023 +0000 1.2 +++ b/etc/init.d/network.sh Tue Jun 06 15:43:18 2023 +0100 1.3 @@ -66,10 +66,11 @@ 1.4 w=="yes"?"wireless":"wired", /start/?"":"-disconnected");}') 1.5 1.6 # FIXME: this valid only for lxde-session 1.7 - local user="$(ps aux 2>/dev/null | grep [l]xde-session | awk 'END{print $2}')" 1.8 + local user="$(ps -e -o user,args 2>/dev/null | grep [l]xde-session | sed 's| .*||')" 1.9 + # works for busybox ps as well as for ps from package procps 1.10 local rpid='' 1.11 [ -s "$npid" ] && rpid="-r $(cat $npid)" 1.12 - su -c "notify-send $rpid -i $icon 'Network' \"$2\"" - $user | tr -c 0-9 '\n' | tail -n1 > $npid 1.13 + su -c "DISPLAY=\"$DISPLAY\" notify-send $rpid -i $icon 'Network' \"$2\"" - "$user" | tr -c 0-9 '\n' | tail -n1 > $npid 1.14 } 1.15 1.16 1.17 @@ -82,7 +83,8 @@ 1.18 done 1.19 # restart if LXPanel running 1.20 if [ -n "$DISPLAY" ] && [ -n "$(which lxpanelctl)" ]; then 1.21 - lxpanelctl restart 1.22 + local user="$(ps -e -o user,args 2>/dev/null | grep [l]xde-session | sed 's| .*||')" 1.23 + su -c "DISPLAY=\"$DISPLAY\" lxpanelctl restart" - "$user" 1.24 fi 1.25 } 1.26