diff --git a/scripts/shell/git-sync-all.sh b/scripts/shell/git-sync-all.sh index 22bf92c..8b7a8cc 100755 --- a/scripts/shell/git-sync-all.sh +++ b/scripts/shell/git-sync-all.sh @@ -1,16 +1,27 @@ -# Clone ~/.emacs.d/ if it doesn't exist, pull otherwise (ff only) -DIRECTORY="$HOME/.emacs.d/" -URL="https://git.xenia.me.uk/pixelifytica/emacs.git" -echo "--- ~/.emacs.d/ ---" -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 +# 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" ) +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 # Sync common directories, setting url to ensure it's up-to-date first SYNC_DIRS=(