diff options
author | Stefan Richter | 2015-10-25 15:47:35 +0100 |
---|---|---|
committer | Stefan Richter | 2015-10-25 15:47:35 +0100 |
commit | a98400d9aeb6117917ac965361d990a38cf6974b (patch) | |
tree | 4fe031976bf417ac282bd11ce59cdbdcd8fd379c /plusberrypi-shutdown.sh | |
download | aur-a98400d9aeb6117917ac965361d990a38cf6974b.tar.gz |
initial files for systemd service (Plusberry Pi Power Button Support)
Diffstat (limited to 'plusberrypi-shutdown.sh')
-rw-r--r-- | plusberrypi-shutdown.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plusberrypi-shutdown.sh b/plusberrypi-shutdown.sh new file mode 100644 index 000000000000..0389bff11997 --- /dev/null +++ b/plusberrypi-shutdown.sh @@ -0,0 +1,17 @@ +#!/bin/bash -e + +echo 24 > /sys/class/gpio/export +echo in > /sys/class/gpio/gpio24/direction + +trap "{ echo 24 > /sys/class/gpio/unexport; exit 0; }" TERM + +while [ true ] +do + if [ $(cat /sys/class/gpio/gpio24/value) == 0 ] + then + poweroff + exit 0 + else + sleep 1 + fi +done |