From d9793108935c6b2276e43f4a0173d8643751ec2d Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Thu, 17 Sep 2015 15:14:27 +0200 Subject: [PATCH] Added emergency unlock scripts --- doorlockd/CMakeLists.txt | 4 ++++ doorlockd/config.h.in | 1 + doorlockd/door.cpp | 3 +-- doorlockd/scripts/emergency_unlock | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100755 doorlockd/scripts/emergency_unlock diff --git a/doorlockd/CMakeLists.txt b/doorlockd/CMakeLists.txt index 0f71e1c..0a5065d 100644 --- a/doorlockd/CMakeLists.txt +++ b/doorlockd/CMakeLists.txt @@ -51,3 +51,7 @@ install(DIRECTORY scripts/ DESTINATION etc/doorlockd/ install(DIRECTORY scripts/ DESTINATION etc/doorlockd/ FILES_MATCHING PATTERN "scripts/post_*lock" PERMISSIONS WORLD_EXECUTE WORLD_READ OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE OWNER_WRITE) + +install(DIRECTORY scripts/ DESTINATION etc/doorlockd/ + FILES_MATCHING PATTERN "scripts/emergency_unlock" + PERMISSIONS WORLD_EXECUTE WORLD_READ OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE OWNER_WRITE) diff --git a/doorlockd/config.h.in b/doorlockd/config.h.in index e1acc5b..eefc842 100644 --- a/doorlockd/config.h.in +++ b/doorlockd/config.h.in @@ -23,5 +23,6 @@ #define POST_LOCK_SCRIPT "@CMAKE_INSTALL_PREFIX@/etc/doorlockd/post_lock &" #define PRE_UNLOCK_SCRIPT "@CMAKE_INSTALL_PREFIX@/etc/doorlockd/pre_unlock &" #define POST_UNLOCK_SCRIPT "@CMAKE_INSTALL_PREFIX@/etc/doorlockd/post_unlock &" +#define EMERGENCY_UNLOCK_SCRIPT "@CMAKE_INSTALL_PREFIX@/etc/doorlockd/emergency_unlock &" #endif diff --git a/doorlockd/door.cpp b/doorlockd/door.cpp index d187f4f..f12d1a8 100644 --- a/doorlockd/door.cpp +++ b/doorlockd/door.cpp @@ -82,7 +82,7 @@ void Door::_asyncRead() goto out; } else if (recvBuf == DOOR_EMERGENCY_UNLOCK) { _logger(LogLevel::warning, "Someone did an emergency unlock!"); - // TODO: Trigger Emergency unlock script + system(EMERGENCY_UNLOCK_SCRIPT); goto out; } @@ -184,4 +184,3 @@ bool Door::writeCMD(char c) _logger(LogLevel::error, "Sent Serial command, but got no response!"); return false; } - diff --git a/doorlockd/scripts/emergency_unlock b/doorlockd/scripts/emergency_unlock new file mode 100755 index 0000000..a9bf588 --- /dev/null +++ b/doorlockd/scripts/emergency_unlock @@ -0,0 +1 @@ +#!/bin/bash