This repository has been archived on 2024-07-03. You can view files and clone it, but cannot push or open issues or pull requests.
home-manager/scripts/shell/git-sync-all.sh

41 lines
1 KiB
Bash
Executable file

# 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
)
# 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 pull --ff --ff-only
git submodule update --remote --recursive
git-sync -ns
git status --porcelain
)
done