infra/roles/mainframe/templates/ghsync.sh.j2

43 lines
649 B
Django/Jinja

#!/bin/bash
# distributed from ansible
set -e
LOCKFILE="/tmp/ghsync.lock"
workdir="/tmp/ghsync"
lockfile -r 0 $LOCKFILE
rm -rf $workdir || true
mkdir $workdir
(
cd $workdir
{% for repo in ghsync_repos %}
echo
echo
echo {{ repo }}
echo "======"
echo
git clone git@git.sudo.is:ben/{{ repo }}.git
(
cd ${workdir}/{{ repo }}
git pull origin master
git remote add github git@github.com:benediktkr/{{ repo }}.git
git push github master --force #| egrep "\.\.|To"
echo {{ repo }}
)
rm -rf ${workdir}/{{ repo }}/
{% endfor %}
)
rmdir /tmp/ghsync
rm -f $LOCKFILE