Evie Litherland-Smith
46457dd08a
Remove elfeed and references repos from git-sync-all as they're now inside org repo
55 lines
1.5 KiB
Bash
Executable file
55 lines
1.5 KiB
Bash
Executable file
# Sync common directories, setting url to ensure it's up-to-date first
|
|
SYNC_DIRS=(
|
|
"$HOME/.password-store/"
|
|
"$HOME/Documents/org/"
|
|
)
|
|
SYNC_URLS=(
|
|
"https://git.xenia.me.uk/pixelifytica/pass.git"
|
|
"https://git.xenia.me.uk/pixelifytica/org.git"
|
|
)
|
|
|
|
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"
|
|
git-sync -ns
|
|
)
|
|
done
|
|
|
|
# Pull NixOS, home-manager and Emacs configs if simple fast-forward
|
|
PULL_DIRS=(
|
|
"${XDG_CONFIG_HOME:-$HOME/.config}/nixos"
|
|
"${XDG_CONFIG_HOME:-$HOME/.config}/home-manager"
|
|
"${XDG_CONFIG_HOME:-$HOME/.config}/emacs"
|
|
)
|
|
PULL_URLS=(
|
|
"https://git.xenia.me.uk/pixelifytica/nixos.git"
|
|
"https://git.xenia.me.uk/pixelifytica/home-manager.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
|
|
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
|
|
git status --porcelain
|
|
)
|
|
done
|