nsbin/sync-all-repos
2022-03-16 18:12:30 +01:00

55 lines
1,020 B
Bash
Executable file

#!/bin/sh
onlystatic="yes"
if [ $# -ge 1 ]; then
onlystatic=""
fi
set -e
for repo in ~/.ctt \
~/bin \
~/vcs/notes \
~/vcs/nico-dot-cdist \
~/vcs/cdist-workdir/dot-cdist \
~/.password-store \
; do
echo $repo
cd $repo
case $repo in
~/.password-store)
git checkout master
git add .
git commit -m "updated by $0" || true
git pull
git checkout nico-privat
;;
~/vcs/cdist-workdir)
mr update
;;
esac
git add .
git commit -m "updated by $0 on $(hostname)" || true
git pull
git push
done
# Step 2: pull/push all other repos in ~/vcs/
# We cannot commit as we do not know the state, but we
# can ensure everything committed before is pushed out
if [ $onlystatic ]; then
exit 0
fi
set +e
for repo in ~/vcs/*; do
echo "$repo"
cd ${repo}
git pull
git push
done