2017-11-25 20:08:58 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-03-16 18:12:30 +01:00
|
|
|
onlystatic="yes"
|
2021-05-26 11:44:44 +02:00
|
|
|
|
2021-05-26 11:45:35 +02:00
|
|
|
if [ $# -ge 1 ]; then
|
2022-03-16 18:12:30 +01:00
|
|
|
onlystatic=""
|
2021-05-26 11:44:44 +02:00
|
|
|
fi
|
|
|
|
|
2017-11-25 20:08:58 +01:00
|
|
|
set -e
|
|
|
|
|
2024-10-02 11:56:20 +09:00
|
|
|
update_repo() {
|
|
|
|
repo=$1
|
2017-11-25 23:03:30 +01:00
|
|
|
echo $repo
|
2017-11-25 20:08:58 +01:00
|
|
|
cd $repo
|
2020-12-08 10:34:41 +01:00
|
|
|
|
2021-03-16 15:10:24 +01: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
|
2020-12-08 10:34:41 +01:00
|
|
|
|
2017-11-25 20:08:58 +01:00
|
|
|
git add .
|
2021-01-25 16:04:59 +01:00
|
|
|
git commit -m "updated by $0 on $(hostname)" || true
|
2017-11-25 20:08:58 +01:00
|
|
|
git pull
|
|
|
|
git push
|
2024-10-02 11:56:20 +09:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2024-10-02 12:03:58 +09:00
|
|
|
for repo in ${REPOLIST}; do ( update_repo $repo & ) ; done
|
2024-10-02 11:58:02 +09:00
|
|
|
|
2024-10-02 12:05:14 +09:00
|
|
|
echo "Waiting for async process to finish ..."
|
2024-10-02 11:58:02 +09:00
|
|
|
wait
|
2024-10-02 12:07:04 +09:00
|
|
|
exit 0
|
|
|
|
|
2024-10-02 12:05:14 +09:00
|
|
|
echo "Starting for sync process ..."
|
2024-10-02 11:58:02 +09:00
|
|
|
|
2024-10-02 12:03:58 +09:00
|
|
|
for repo in ${REPOLIST}; do update_repo $repo ; done
|
2021-01-17 14:13:27 +01:00
|
|
|
|
2024-03-25 08:46:57 +01:00
|
|
|
# Repos we want to sync, but don't want to update the working tree
|
|
|
|
for repo in \
|
2024-03-22 10:13:25 +01:00
|
|
|
~/vcs/k8s-config/ \
|
|
|
|
~/vcs/ansible-main/ \
|
|
|
|
; do
|
2024-03-25 08:46:57 +01:00
|
|
|
echo $repo
|
|
|
|
cd $repo
|
2024-03-22 10:13:25 +01:00
|
|
|
git pull
|
2024-03-25 08:46:57 +01:00
|
|
|
git push
|
2024-03-22 10:13:25 +01:00
|
|
|
done
|
|
|
|
|
2021-01-17 14:13:27 +01:00
|
|
|
# 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 11:44:44 +02:00
|
|
|
if [ $onlystatic ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2021-01-18 18:17:23 +01:00
|
|
|
set +e
|
|
|
|
|
2021-01-17 14:13:27 +01:00
|
|
|
for repo in ~/vcs/*; do
|
2021-01-17 14:14:39 +01:00
|
|
|
echo "$repo"
|
2021-01-17 14:13:27 +01:00
|
|
|
cd ${repo}
|
|
|
|
git pull
|
|
|
|
git push
|
|
|
|
done
|