parent
8c52656d05
commit
4734368f0c
|
@ -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))
|
||||||
|
|
31
system/home/scripts/shell/gsync.sh
Executable file
31
system/home/scripts/shell/gsync.sh
Executable 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
|
Loading…
Reference in a new issue