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

32 lines
890 B
Bash
Executable file

# Sync common directories, setting url to ensure it's up-to-date first
SYNC_DIRS=(
"$HOME/.password-store/"
"$HOME/.elfeed/"
"$HOME/Documents/Org/"
"$HOME/Documents/References/"
)
SYNC_URLS=(
"https://git.xenia.me.uk/pixelifytica/pass.git"
"https://git.xenia.me.uk/pixelifytica/elfeed.git"
"https://git.xenia.me.uk/pixelifytica/org.git"
"https://git.xenia.me.uk/pixelifytica/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
# Pull NixOS and Emacs config if simple fast-forward
git -C /etc/nixos pull --ff-only
git -C "${XDG_CONFIG_HOME:-$HOME/.config}/emacs" pull --ff-only