SATS/update

29 lines
568 B
Bash
Executable File

#!/bin/bash
__DIR__=$(dirname $(realpath $0));
source $__DIR__/lib/include/bash/const;
source $__DIR__/lib/include/bash/func;
# (1) Check if synchronization done #
if [ ! -e /target/sync ]; then
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;
# (3) Update source
BRANCH=$(cat $BRANCH_CONF);
cd $SOURCE_DIR
git checkout $BRANCH;
test $? -ne 0 && exit 127;
git pull origin $BRANCH;
test $? -ne 0 && exit 127;