Code style and shellcheck
This commit is contained in:
45
debian/usr/sbin/foodoor
vendored
45
debian/usr/sbin/foodoor
vendored
@ -1,37 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
PIPE_PATH=/var/run/foodoord.pipe
|
||||
|
||||
if [ ! -e $PIPE_PATH ]
|
||||
then
|
||||
echo "Pipe missing. Check daemon status."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e $PIPE_PATH ]; then
|
||||
echo "Pipe missing. Check daemon status."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
action="$1"
|
||||
isTriggerActivated="0"
|
||||
action=$1
|
||||
isTriggerActivated=0
|
||||
|
||||
if [ -z "$action" ]
|
||||
then
|
||||
action="$SSH_ORIGINAL_COMMAND"
|
||||
isTriggerActivated="1"
|
||||
fi
|
||||
if [ -z "$action" ]; then
|
||||
action=$SSH_ORIGINAL_COMMAND
|
||||
isTriggerActivated=1
|
||||
fi
|
||||
|
||||
case $action in
|
||||
close|open)
|
||||
echo $action | tee $PIPE_PATH |sed 's/open/UNLOCKED/;s/close/LOCKED/' > /state
|
||||
;;
|
||||
status)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $(basename $0) { close, open, status }"
|
||||
close | open)
|
||||
echo "$action" | tee "$PIPE_PATH" | sed 's/open/UNLOCKED/;s/close/LOCKED/' > /state
|
||||
;;
|
||||
status) ;;
|
||||
*)
|
||||
echo "Usage: $(basename "$0") { close, open, status }"
|
||||
exit 1
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $isTriggerActivated -eq 1 ]
|
||||
then
|
||||
cat /state
|
||||
sleep 2
|
||||
if [ $isTriggerActivated -eq 1 ]; then
|
||||
cat /state
|
||||
sleep 2
|
||||
fi
|
||||
|
Reference in New Issue
Block a user