nsbin/icrc-sync

33 lines
690 B
Text
Raw Permalink Normal View History

2025-11-14 11:17:47 +01:00
#!/bin/sh
2025-11-14 11:23:50 +01:00
if [ $# -ne 1 ]; then
echo "$0 (from|to)"
echo "syncing from or to it ..."
exit 1
fi
cd ~/vcs
# First sync our notes repo
if [ -d ~/vcs/icrc ]; then
cd ~/vcs/icrc
git pull
else
git clone ssh://git@code.ungleich.ch/nico/icrc.git
fi
2025-11-14 11:23:50 +01:00
fromto=$1; shift
2025-11-14 11:17:47 +01:00
dir=/mnt/c/Users/A090964/vcs/
repolist=$(ssh icrcnb "cd $dir; ls -1 icrc*")
2025-11-14 11:17:47 +01:00
echo $repolist
for repo in $repolist; do
2025-11-14 11:23:50 +01:00
if [ "$fromto" = "from" ]; then
mkdir -p ~/vcs/icrc-${repo}
rsync -av --delete icrcnb:${dir}/${repo}/.git/ ~/vcs/icrc-${repo}/.git
2025-11-14 11:23:50 +01:00
fi
if [ "$fromto" = "to" ]; then
rsync -av --delete ~/vcs/icrc-${repo}/.git/ icrcnb:${dir}/${repo}/.git
2025-11-14 11:23:50 +01:00
fi
2025-11-14 11:17:47 +01:00
done