1
0
mirror of https://github.com/docker/cli.git synced 2025-08-29 00:47:54 +03:00
Files
cli/scripts/docs/generate-man.sh
Morten Linderud 29bd82ba14 generate-man.sh: Only build md2man if it's not installed
Distributions uses generate-man.sh to create man pages, however it only
assumes a container environment and attempts to build binaries towards
`/go` which might be an illegal path in `fakeroot`.

This patch ensures we only build `md2man` from the vendored sources if
the command is not present. This allows distributions to supply thier
packaged `md2man`.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2020-12-09 23:06:18 +01:00

18 lines
497 B
Bash
Executable File

#!/usr/bin/env bash
# Generate man pages for docker/cli
set -eu -o pipefail
mkdir -p ./man/man1
if ! command -v md2man &> /dev/null; then
# yay, go install creates a binary named "v2" ¯\_(ツ)_/¯
go build -o "/go/bin/md2man" ./vendor/github.com/cpuguy83/go-md2man/v2
fi
# Generate man pages from cobra commands
go build -o /tmp/gen-manpages github.com/docker/cli/man
/tmp/gen-manpages --root "$(pwd)" --target "$(pwd)/man/man1"
# Generate legacy pages from markdown
./man/md2man-all.sh -q