nixos/system/home/scripts/shell/rsync-local-config.sh
Evie Litherland-Smith a52ccf7ef4 Remove git-sync service, use gsync.sh script again instead
Delete some unused (test) scripts

Reduce what is sync'd by rsync-local-config: remove fonts, bat config
and zellij config
2024-10-22 11:36:21 +01:00

24 lines
793 B
Bash
Executable file

HOSTS=("$@")
# Config files
for TARGET in ".inputrc" ".config/starship.toml"; do
SOURCE="$HOME/$TARGET"
echo "--- $SOURCE ---"
TMP_TARGET=/tmp/rsync-local-config
TMP_SOURCE=$TMP_TARGET
NIX_SED="sed -i 's|/nix/.*/bin/||g'"
NIX_REPLACE="$NIX_SED $TMP_TARGET"
if [[ -e $SOURCE ]]; then
if [[ -d $SOURCE ]]; then
SOURCE=$SOURCE/
TMP_SOURCE=$TMP_SOURCE/
NIX_REPLACE="fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};"
fi
rsync -avzL --exclude=".git*" --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r "$SOURCE" $TMP_TARGET
sh -c "$NIX_REPLACE"
for HOST in "${HOSTS[@]}"; do
rsync -avzL --delete --exclude=".git*" $TMP_SOURCE "$HOST:$TARGET"
done
rm -rf $TMP_SOURCE
fi
done