Finish conf-sync.sh

This commit is contained in:
Alexandre CATTEAU 2022-03-13 11:40:33 +01:00
parent 1b7aa49227
commit 5d5c9033f4

13
conf-sync.sh Normal file → Executable file
View File

@ -2,12 +2,13 @@
source "$(dirname "$0")/variables.conf" source "$(dirname "$0")/variables.conf"
for dir in $sync_directory; do for dir in $sync_directory/*; do
git -C $dir rev-parse 2>/dev/null git -C $dir rev-parse 2>/dev/null >/dev/null
if [ "$?" -ne 0 ]; then # ie. this is not a git repo if [ "$?" -ne 0 ]; then
echo "$dir: not a Git repo"
continue continue
fi fi
git -C $dir fetch git -C $dir fetch 2>/dev/null >/dev/null
UPSTREAM=${1:-'@{u}'} UPSTREAM=${1:-'@{u}'}
LOCAL=$(git -C $dir rev-parse @) LOCAL=$(git -C $dir rev-parse @)
REMOTE=$(git -C $dir rev-parse "$UPSTREAM") REMOTE=$(git -C $dir rev-parse "$UPSTREAM")
@ -16,8 +17,8 @@ for dir in $sync_directory; do
echo "$dir: up-to-date" echo "$dir: up-to-date"
elif [ $LOCAL = $BASE ]; then elif [ $LOCAL = $BASE ]; then
echo "pulling $dir" echo "pulling $dir"
git -C pull git -C $dir pull 2>/dev/null >/dev/null
if []; then if [ -e $dir/install.sh ]; then
echo "Running $dir\'s install script..." echo "Running $dir\'s install script..."
$dir/install.sh $dir/install.sh
fi fi