From: Michael Mrozek Date: Sat, 12 Nov 2011 01:33:43 +0000 (+0100) Subject: op_power.sh: Tested if file exists before rm to prevent error messages X-Git-Tag: sz_beta3~63 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=commitdiff_plain;h=0decb5f91810b0eabf857813b2a6ce5857639ceb op_power.sh: Tested if file exists before rm to prevent error messages --- diff --git a/recipes/pandora-system/pandora-scripts/op_power.sh b/recipes/pandora-system/pandora-scripts/op_power.sh index 552ac0c..b2acf74 100644 --- a/recipes/pandora-system/pandora-scripts/op_power.sh +++ b/recipes/pandora-system/pandora-scripts/op_power.sh @@ -26,16 +26,16 @@ lowPowerOn(){ #switch from normal to lowpower mode do kill -19 $PID #send SIGSTOP done - rm /tmp/hcistate + test -f /tmp/hcistate && rm /tmp/hcistate hcistate=$(hciconfig hci0 | grep DOWN) if [ $hcistate ]; then echo "down" > /tmp/hcistate else hciconfig hci0 down fi - rm /tmp/wlstate + test -f /tmp/wlstate && rm /tmp/wlstate wlstate=$(lsmod | grep -m1 wl1251) - if [ ! $wlstate ]; then + if [ -z "$wlstate" ]; then echo "down" > /tmp/wlstate else ifconfig wlan0 down @@ -65,7 +65,7 @@ lowPowerOff(){ # switch from lowpower to normal mode hciconfig hci0 up pscan fi wlstate=$(cat /tmp/wlstate) - if [ ! $wlstate ]; then + if [ -z "$wlstate" ]; then /etc/init.d/wl1251-init start fi pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')