2024-03-08 08:07:51 +00:00
|
|
|
# Sync common directories, setting url to ensure it's up-to-date first
|
2024-02-14 08:34:30 +00:00
|
|
|
SYNC_DIRS=(
|
|
|
|
"$HOME/.password-store/"
|
2024-04-06 13:49:08 +01:00
|
|
|
"$HOME/.diary/"
|
2024-03-08 06:49:05 +00:00
|
|
|
"$HOME/.elfeed/"
|
2024-02-14 08:34:30 +00:00
|
|
|
"$HOME/Documents/Org/"
|
|
|
|
"$HOME/Documents/References/"
|
|
|
|
)
|
|
|
|
SYNC_URLS=(
|
2024-03-08 06:41:40 +00:00
|
|
|
"https://git.xenia.me.uk/pixelifytica/pass.git"
|
2024-04-06 13:49:08 +01:00
|
|
|
"https://git.xenia.me.uk/pixelifytica/diary.git"
|
2024-03-08 06:49:05 +00:00
|
|
|
"https://git.xenia.me.uk/pixelifytica/elfeed.git"
|
2024-03-08 06:41:40 +00:00
|
|
|
"https://git.xenia.me.uk/pixelifytica/org.git"
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/references.git"
|
2024-02-14 08:34:30 +00:00
|
|
|
)
|
2024-02-01 11:35:41 +00:00
|
|
|
|
2024-02-14 08:34:30 +00:00
|
|
|
for i in "${!SYNC_DIRS[@]}"; do
|
|
|
|
DIRECTORY="${SYNC_DIRS[$i]}"
|
|
|
|
URL="${SYNC_URLS[$i]}"
|
2024-03-08 08:15:32 +00:00
|
|
|
echo "--- sync: $DIRECTORY ---"
|
2024-02-14 08:34:30 +00:00
|
|
|
if [ ! -d "$DIRECTORY" ]; then
|
|
|
|
git clone "$URL" "$DIRECTORY"
|
|
|
|
fi
|
2024-02-05 06:22:44 +00:00
|
|
|
(
|
|
|
|
cd "$DIRECTORY" || exit
|
2024-02-14 08:34:30 +00:00
|
|
|
git remote set-url origin "$URL"
|
2024-02-05 06:22:44 +00:00
|
|
|
git-sync -ns
|
|
|
|
)
|
2024-01-14 14:38:22 +00:00
|
|
|
done
|
2024-03-08 08:07:51 +00:00
|
|
|
|
|
|
|
# Pull NixOS and Emacs config if simple fast-forward
|
2024-03-08 08:15:32 +00:00
|
|
|
PULL_DIRS=(
|
|
|
|
"/etc/nixos"
|
|
|
|
"${XDG_CONFIG_HOME:-$HOME/.config}/emacs"
|
|
|
|
)
|
|
|
|
PULL_URLS=(
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/nixos.git"
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/emacs.git"
|
|
|
|
)
|
|
|
|
for i in "${!PULL_DIRS[@]}"; do
|
|
|
|
DIRECTORY="${PULL_DIRS[$i]}"
|
|
|
|
URL="${PULL_URLS[$i]}"
|
|
|
|
echo "--- pull: $DIRECTORY ---"
|
|
|
|
if [ ! -d "$DIRECTORY" ]; then
|
|
|
|
git clone "$URL" "$DIRECTORY"
|
|
|
|
fi
|
|
|
|
(
|
|
|
|
cd "$DIRECTORY" || exit
|
2024-04-11 23:08:55 +01:00
|
|
|
if [ "$(git branch --show-current)" = "main" ]; then
|
|
|
|
git remote set-url origin "$URL"
|
|
|
|
git pull --ff-only
|
|
|
|
git push
|
|
|
|
else
|
|
|
|
echo "Not syncing repo $DIRECTORY on branch $(git branch --show-current)"
|
|
|
|
fi
|
2024-03-08 08:15:32 +00:00
|
|
|
)
|
|
|
|
done
|