From 5d5c9033f4f885a8fa692e560fb6130f9ff8d438 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 13 Mar 2022 11:40:33 +0100 Subject: [PATCH] Finish conf-sync.sh --- conf-sync.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) mode change 100644 => 100755 conf-sync.sh diff --git a/conf-sync.sh b/conf-sync.sh old mode 100644 new mode 100755 index 3296fcd..53f7481 --- a/conf-sync.sh +++ b/conf-sync.sh @@ -2,12 +2,13 @@ source "$(dirname "$0")/variables.conf" -for dir in $sync_directory; do - git -C $dir rev-parse 2>/dev/null - if [ "$?" -ne 0 ]; then # ie. this is not a git repo +for dir in $sync_directory/*; do + git -C $dir rev-parse 2>/dev/null >/dev/null + if [ "$?" -ne 0 ]; then + echo "$dir: not a Git repo" continue fi - git -C $dir fetch + git -C $dir fetch 2>/dev/null >/dev/null UPSTREAM=${1:-'@{u}'} LOCAL=$(git -C $dir rev-parse @) REMOTE=$(git -C $dir rev-parse "$UPSTREAM") @@ -16,8 +17,8 @@ for dir in $sync_directory; do echo "$dir: up-to-date" elif [ $LOCAL = $BASE ]; then echo "pulling $dir" - git -C pull - if []; then + git -C $dir pull 2>/dev/null >/dev/null + if [ -e $dir/install.sh ]; then echo "Running $dir\'s install script..." $dir/install.sh fi