From 6ea77ddd9f07ce905823d00852d67871943b62ea Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 21 Jul 2017 12:44:45 +0200 Subject: [PATCH] Managing locally /target/sync --- daemon | 5 +++++ update | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/daemon b/daemon index 4fae714..f90e1fb 100755 --- a/daemon +++ b/daemon @@ -2,4 +2,9 @@ ABSPATH=$( dirname $(realpath $0) ); +# (1) Check synchronization done # +if [ ! -e /target/sync ]; then + slog "[!] not synced yet, aborting" - "daemon" && exit 127; +fi; + $ABSPATH/lib/mfrc522/loop; diff --git a/update b/update index 361b6e7..f7bc9bb 100755 --- a/update +++ b/update @@ -5,23 +5,20 @@ __DIR__=$(dirname $(realpath $0)); source $__DIR__/lib/include/bash/const; source $__DIR__/lib/include/bash/func; -# [1] Send data + fetch configuration +# (1) Check if synchronization done # if [ ! -e /target/sync ]; then - - test "$($SOURCE_DIR/lib/api/sync)" = "127" && slog "sync failed" - "update" && exit 127; - - touch /target/sync; -else - - test "$($SOURCE_DIR/lib/api/update)" = "127" && slog "update failed" - "update" && exit 127; + slog "not synchronized yet, aborting" - "update" && exit 127; fi; +# (2) Send data + fetch configuration +test "$($SOURCE_DIR/lib/api/update)" = "127" && slog "update failed" - "update" && exit 127; -# [2] Update source + +# (3) Update source BRANCH=$(cat $BRANCH_CONF); cd $SOURCE_DIR