nsbin/sync-all-repos

73 lines
1.3 KiB
Text
Raw Normal View History

2017-11-25 19:08:58 +00:00
#!/bin/sh
onlystatic="yes"
2021-05-26 09:44:44 +00:00
if [ $# -ge 1 ]; then
onlystatic=""
2021-05-26 09:44:44 +00:00
fi
2017-11-25 19:08:58 +00:00
set -e
update_repo() {
repo=$1
2017-11-25 22:03:30 +00:00
echo $repo
2017-11-25 19:08:58 +00:00
cd $repo
2021-03-16 14:10:24 +00:00
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
2017-11-25 19:08:58 +00:00
git add .
2021-01-25 15:04:59 +00:00
git commit -m "updated by $0 on $(hostname)" || true
2017-11-25 19:08:58 +00:00
git pull
git push
}
REPOLIST="$HOME/.ctt $HOME/bin $HOME/vcs/notes $HOME/vcs/nico-dot-cdist $HOME/vcs/cdist-workdir/dot-cdist $HOME/vcs/ansible-main"
REPOLIST2="$REPOLIST $HOME/.password-store"
# First in parallel, then en sequence to spot errors
for repo in ${REPOLIST}; do ( update_repo $repo & ) ; done
wait
for repo in ${REPOLIST}; do update_repo $repo ; done
# Repos we want to sync, but don't want to update the working tree
for repo in \
2024-03-22 09:13:25 +00:00
~/vcs/k8s-config/ \
~/vcs/ansible-main/ \
; do
echo $repo
cd $repo
2024-03-22 09:13:25 +00:00
git pull
git push
2024-03-22 09:13:25 +00:00
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
2021-05-26 09:44:44 +00:00
if [ $onlystatic ]; then
exit 0
fi
set +e
for repo in ~/vcs/*; do
echo "$repo"
cd ${repo}
git pull
git push
done