#!/bin/bash # # Create/clone new projects from upstreams. # This script is intended to be run as a cronjob. # BASE_DIR=/srv/mirror MIRROR_DIR=$BASE_DIR/gerrit-mirror if [ ! -d $MIRROR_DIR ]; then mkdir -p $MIRROR_DIR fi fatal () { echo $1 exit 1 } # Require explicit flag to clone new projects, to avoid spurious clones when # run on a local system to just create new projects. Should be specified # first if any other options are given. if [ "$1" == "--clone" ]; then clone=1 shift fi ./git-gerrit-mirror --mirror-dir=$MIRROR_DIR create $* if [ -n "$clone" ]; then ./git-gerrit-mirror --mirror-dir=$MIRROR_DIR --quiet clone $* fi