Revert "Remove gsync script"

This reverts commit 50371a5ad1.
This commit is contained in:
Evie Litherland-Smith 2024-10-22 09:15:30 +01:00
parent 8c52656d05
commit 4734368f0c
2 changed files with 32 additions and 0 deletions

View file

@ -3,6 +3,7 @@
home.packages = [ home.packages = [
(pkgs.writeShellScriptBin "ensure-pass" (builtins.readFile ./shell/ensure-pass.sh)) (pkgs.writeShellScriptBin "ensure-pass" (builtins.readFile ./shell/ensure-pass.sh))
(pkgs.writeShellScriptBin "esync" (builtins.readFile ./shell/esync.sh)) (pkgs.writeShellScriptBin "esync" (builtins.readFile ./shell/esync.sh))
(pkgs.writeShellScriptBin "gsync" (builtins.readFile ./shell/gsync.sh))
(pkgs.writeShellScriptBin "clean-config" (builtins.readFile ./shell/clean-config.sh)) (pkgs.writeShellScriptBin "clean-config" (builtins.readFile ./shell/clean-config.sh))
(pkgs.writeShellScriptBin "rsync-local-config" (builtins.readFile ./shell/rsync-local-config.sh)) (pkgs.writeShellScriptBin "rsync-local-config" (builtins.readFile ./shell/rsync-local-config.sh))
(pkgs.writeShellScriptBin "xdg-query-program" (builtins.readFile ./shell/xdg-query-program.sh)) (pkgs.writeShellScriptBin "xdg-query-program" (builtins.readFile ./shell/xdg-query-program.sh))

View file

@ -0,0 +1,31 @@
# Sync common directories, setting url to ensure it's up-to-date first
SYNC_DIRS=(
"$HOME/.password-store/"
"$HOME/Documents/org/"
"$HOME/Documents/library/"
)
SYNC_URLS=(
"https://git.xenia.me.uk/pixelifytica/pass.git"
"https://git.xenia.me.uk/pixelifytica/org.git"
"https://git.xenia.me.uk/pixelifytica/library.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"
if [ "$(git branch --show-current)" = "main" ]; then
git branch --set-upstream-to=origin/main main
fi
git pull --ff --ff-only
git submodule update --remote --recursive
git-sync -ns
git status --porcelain
)
done