op_power.sh: Tested if file exists before rm to prevent error messages
authorMichael Mrozek <EvilDragon@openpandora.de>
Sat, 12 Nov 2011 01:33:43 +0000 (02:33 +0100)
committerMichael Mrozek <EvilDragon@openpandora.de>
Sat, 12 Nov 2011 01:33:43 +0000 (02:33 +0100)
recipes/pandora-system/pandora-scripts/op_power.sh

index 552ac0c..b2acf74 100644 (file)
@@ -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')