2024-06-07 06:01:43 +01:00
|
|
|
# Clone ~/.emacs.d/ and ~/.config/home-manager if then don't exist,
|
|
|
|
# pull otherwise (ff only)
|
|
|
|
PULL_DIRS=(
|
|
|
|
"$HOME/.emacs.d/"
|
|
|
|
"${XDG_CONFIG_HOME:-$HOME/.config}/home-manager"
|
2024-05-22 07:08:06 +01:00
|
|
|
)
|
2024-06-07 06:01:43 +01:00
|
|
|
PULL_URLS=(
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/emacs.git"
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/home-manager.git"
|
|
|
|
)
|
|
|
|
for i in "${!PULL_DIRS[@]}"; do
|
|
|
|
DIRECTORY="${PULL_DIRS[$i]}"
|
|
|
|
URL="${PULL_URLS[$i]}"
|
|
|
|
echo "--- $DIRECTORY ---"
|
|
|
|
if [ ! -d "$DIRECTORY" ]; then
|
|
|
|
git clone "$URL" "$DIRECTORY"
|
|
|
|
fi
|
|
|
|
(
|
|
|
|
cd "$DIRECTORY" || exit
|
|
|
|
git remote set-url origin "$URL"
|
|
|
|
git pull --ff --ff-only
|
|
|
|
git status --porcelain
|
|
|
|
)
|
|
|
|
done
|
2024-05-22 07:08:06 +01:00
|
|
|
|
2024-05-11 13:55:23 +01:00
|
|
|
# Sync common directories, setting url to ensure it's up-to-date first
|
|
|
|
SYNC_DIRS=(
|
|
|
|
"$HOME/.password-store/"
|
2024-05-15 07:44:27 +01:00
|
|
|
"$HOME/Documents/org/"
|
2024-06-13 10:13:31 +01:00
|
|
|
"$HOME/Documents/library/"
|
2024-06-20 19:00:58 +01:00
|
|
|
"$HOME/Documents/notebooks/"
|
2024-05-11 13:55:23 +01:00
|
|
|
)
|
|
|
|
SYNC_URLS=(
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/pass.git"
|
|
|
|
"https://git.xenia.me.uk/pixelifytica/org.git"
|
2024-06-13 10:13:31 +01:00
|
|
|
"https://git.xenia.me.uk/pixelifytica/library.git"
|
2024-06-20 19:00:58 +01:00
|
|
|
"git@git.ccfe.ac.uk:elitherl/notebooks.git"
|
2024-05-11 13:55:23 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
for i in "${!SYNC_DIRS[@]}"; do
|
|
|
|
DIRECTORY="${SYNC_DIRS[$i]}"
|
|
|
|
URL="${SYNC_URLS[$i]}"
|
|
|
|
echo "--- sync: $DIRECTORY ---"
|
|
|
|
if [ ! -d "$DIRECTORY" ]; then
|
|
|
|
git clone "$URL" "$DIRECTORY"
|
|
|
|
fi
|
|
|
|
(
|
|
|
|
cd "$DIRECTORY" || exit
|
|
|
|
git remote set-url origin "$URL"
|
2024-06-13 17:38:20 +01:00
|
|
|
if [ "$(git branch --show-current)" = "main" ]; then
|
|
|
|
git branch --set-upstream-to=origin/main main
|
|
|
|
fi
|
2024-05-21 07:06:17 +01:00
|
|
|
git pull --ff --ff-only
|
|
|
|
git submodule update --remote --recursive
|
2024-05-11 13:55:23 +01:00
|
|
|
git-sync -ns
|
2024-05-21 07:06:17 +01:00
|
|
|
git status --porcelain
|
2024-05-11 13:55:23 +01:00
|
|
|
)
|
|
|
|
done
|