nixos/home/scripts/git-sync-all.sh

25 lines
572 B
Bash
Raw Normal View History

SYNC_DIRS=(
"$HOME/.password-store/"
"$HOME/Documents/Org/"
"$HOME/Documents/References/"
)
SYNC_URLS=(
"https://git.xenia.me.uk/xenia/pass.git"
"https://git.xenia.me.uk/xenia/org.git"
"https://git.xenia.me.uk/xenia/references.git"
)
for i in "${!SYNC_DIRS[@]}"; do
DIRECTORY="${SYNC_DIRS[$i]}"
URL="${SYNC_URLS[$i]}"
echo "--- $DIRECTORY ---"
if [ ! -d "$DIRECTORY" ]; then
git clone "$URL" "$DIRECTORY"
fi
(
cd "$DIRECTORY" || exit
git remote set-url origin "$URL"
git-sync -ns
)
done