repo-cloner/dockerbin/run-mirror-update

36 lines
570 B
Plaintext
Raw Normal View History

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
function log(){
local title=${raw:-$name}
[ -z "$title" ] || title=" [$title]"
echo "[$(date +"%X")]$title $@"
}
function die(){
log "$@" 1>&2
exit 1
}
scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
function finish {
rm -rf "$scratch"
}
trap finish EXIT
# necessary checks
pathto=${1:-}
[ -n "$pathto" ] || die "No project specified"
raw=$(basename $pathto | sed 's/^cloner-//g')
# is it enabled?
[ -f "$pathto/.enabled" ] || die "$raw not enabled!"
env BASE=$pathto run-checker | while read line; do log "$line"; done