#!/bin/bash set -e cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" repo="$1" if [ -z "$repo" ]; then echo >&2 'error: no repo specified' cat >&2 < README.md] ie: $0 php > ../php/README.md This script generates a stub README to standard out for the specified repo. EOUSAGE exit 1 fi gitRepo='https://github.com/docker-library/docs' hubPage="https://registry.hub.docker.com/_/$repo/" canonicalRepo="https://github.com/docker-library/$repo" if [ -s "$repo/github-repo" ]; then canonicalRepo="$(< "$repo/github-repo")" fi canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "$canonicalRepo")" # follow redirects (http://stackoverflow.com/a/3077316/433558) travisRepo="${canonicalRepo#*://github.com/}" cat < /dev/null; then travisLink="https://travis-ci.org/$travisRepo/branches" badges+=( "-${t}[Travis CI: ${n}${t}![build status badge]($travisImage)]($travisLink)" ) fi jenkinsImage="https://doi-janky.infosiftr.net/job/update.sh/job/$repo/badge/icon" if wget -q --spider "$jenkinsImage" &> /dev/null; then jenkinsLink="https://doi-janky.infosiftr.net/job/update.sh/job/$repo" badges+=( "-${t}[Automated \`update.sh\`: ${n}${t}![build status badge]($jenkinsImage)]($jenkinsLink)" ) fi if [ "${#badges[@]}" -gt 0 ]; then IFS=$'\n' cat <<-EOREADME --- ${badges[*]} EOREADME unset IFS fi cat < EOREADME