check if statefile exists
authorvimacs <vimacs@pndtest>
Thu, 18 Feb 2010 15:20:25 +0000 (16:20 +0100)
committervimacs <vimacs@pndtest>
Thu, 18 Feb 2010 15:20:25 +0000 (16:20 +0100)
modified:   testdata/scripts/op_power.sh

testdata/scripts/op_power.sh

index d6d4fa5..98354b3 100755 (executable)
@@ -3,8 +3,12 @@
 #only argument is the time the button was pressed in  seconds
 
 if [ "$1" -le "3" ]; then # button was pressed 1-3sec, "suspend"
-  powerstate=$(cat /tmp/powerstate)
-  if [$powerstate -eq "1" ]; then
+  if [ -e /tmp/powerstate ]; then 
+    powerstate=$(cat /tmp/powerstate)
+  else
+    powerstate=0
+  fi
+  if [$powerstate -eq 1 ]; then
     #in lowpower mode
     echo 0 > /tmp/powerstate
     oldbright=$(cat /tmp/oldbright)