Managing locally /target/sync

This commit is contained in:
xdrm-brackets 2017-07-21 12:44:45 +02:00
parent 0bf05fe763
commit 6ea77ddd9f
2 changed files with 11 additions and 9 deletions

5
daemon
View File

@ -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;

15
update
View File

@ -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