From f63f822dc3afc429988d2ddee2a164068df9f78a Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Tue, 29 Mar 2022 18:39:07 -0700 Subject: Update our wrappers. Gitea, we do not support anymore. Gitlab, we are starting to support. Signed-off-by: Alec Warner --- gitea-mirror/gitea-mirror | 27 --------------------------- gitea-mirror/gitea-ssh-wrapper | 4 ---- gitlab-mirror/gitlab-mirror | 24 ++++++++++++++++++++++++ gitlab-mirror/gitlab-ssh-wrapper | 4 ++++ 4 files changed, 28 insertions(+), 31 deletions(-) delete mode 100755 gitea-mirror/gitea-mirror delete mode 100755 gitea-mirror/gitea-ssh-wrapper create mode 100755 gitlab-mirror/gitlab-mirror create mode 100755 gitlab-mirror/gitlab-ssh-wrapper diff --git a/gitea-mirror/gitea-mirror b/gitea-mirror/gitea-mirror deleted file mode 100755 index 0c39975..0000000 --- a/gitea-mirror/gitea-mirror +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# based on https://github.com/miracle2k/gitolite-simple-mirror/blob/master/post-receive - -# simple gitolite mirroring - -# flush STDIN coming from git, because gitolite's own post-receive.mirrorpush -# script does the same thing -[ -t 0 ] || cat >/dev/null - -if [ -z "${GL_REPO}" ]; then - echo "GL_REPO not set" >&2 - exit 1 -fi - -targets=$(git config --get gentoo.mirror.url) -[ -z "${targets}" ] && exit 0 - -[ -z "${GIT_SSH_KEY}" ] && export GIT_SSH_KEY=$(git config --get gitea.mirror.pubkey) -[ -z "${GIT_SSH_KEY}" ] && export GIT_SSH_KEY=$(git config --get gentoo.mirror.pubkey) -# TODO: fix this into version control! -: ${GIT_SSH_KEY:=/home/antarus/gitea-mirror/gentoo-gitea.ssh.priv} -export GIT_SSH=$(dirname "$(readlink -f "$0")")/gitea-ssh-wrapper - -for target in ${targets}; do - # --force because someone may accidentally push into the mirror - git push --mirror --force ${target} -done diff --git a/gitea-mirror/gitea-ssh-wrapper b/gitea-mirror/gitea-ssh-wrapper deleted file mode 100755 index 5f4c1fc..0000000 --- a/gitea-mirror/gitea-ssh-wrapper +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Use via GIT_SSH - -exec ssh ${GIT_SSH_KEY:+-i} ${GIT_SSH_KEY} "$@" diff --git a/gitlab-mirror/gitlab-mirror b/gitlab-mirror/gitlab-mirror new file mode 100755 index 0000000..5daf384 --- /dev/null +++ b/gitlab-mirror/gitlab-mirror @@ -0,0 +1,24 @@ +#!/bin/sh +# based on https://github.com/miracle2k/gitolite-simple-mirror/blob/master/post-receive + +# simple gitolite mirroring + +# flush STDIN coming from git, because gitolite's own post-receive.mirrorpush +# script does the same thing +[ -t 0 ] || cat >/dev/null + +if [ -z "${GL_REPO}" ]; then + echo "GL_REPO not set" >&2 + exit 1 +fi + +targets=$(git config --get gitlab.mirror.url) +[ -z "${targets}" ] && exit 0 + +[ -z "${GIT_SSH_KEY}" ] && export GIT_SSH_KEY=$(git config --get gitlab.mirror.pubkey) +export GIT_SSH=$(dirname "$(readlink -f "$0")")/gitlab-ssh-wrapper + +for target in ${targets}; do + # --force because someone may accidentally push into the mirror + git push --mirror --force ${target} +done diff --git a/gitlab-mirror/gitlab-ssh-wrapper b/gitlab-mirror/gitlab-ssh-wrapper new file mode 100755 index 0000000..5f4c1fc --- /dev/null +++ b/gitlab-mirror/gitlab-ssh-wrapper @@ -0,0 +1,4 @@ +#!/bin/sh +# Use via GIT_SSH + +exec ssh ${GIT_SSH_KEY:+-i} ${GIT_SSH_KEY} "$@" -- cgit v1.2.3-65-gdbad