1
0
mirror of https://github.com/containers/netavark.git synced 2026-02-05 06:45:56 +01:00

Add man page and install to Makefile

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2021-10-14 10:58:58 -04:00
parent 35df52f53b
commit 2d461e397b
3 changed files with 88 additions and 1 deletions

View File

@@ -20,13 +20,28 @@ build:
clean:
rm -rf bin
$(MAKE) -C docs clean
.PHONY: docs
docs: ## build the docs on the host
$(MAKE) -C docs
.PHONY: install
install:
install -D -m0755 bin/buildah $(DESTDIR)/$(BINDIR)/netavark
$(MAKE) -C docs install
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)/$(BINDIR)/netavark
rm -f $(PREFIX)/share/man/man1/netavark*.1
test:
cargo test
validate:
cargo clippy -p netavark -- -D warnings
all: build
all: build docs
help:
@echo "usage: make $(prog) [debug=1]"

27
docs/Makefile Normal file
View File

@@ -0,0 +1,27 @@
PREFIX := /usr/local
DATADIR := ${PREFIX}/share
MANDIR := $(DATADIR)/man
GOMD2MAN ?= $(shell command -v go-md2man || echo '$(GOBIN)/go-md2man')
docs: $(patsubst %.md,%,$(wildcard *.md))
%.1: %.1.md
### sed is used to filter http/s links as well as relative links
### replaces "\" at the end of a line with two spaces
### this ensures that manpages are renderd correctly
@sed -e 's/\((buildah[^)]*\.md\(#.*\)\?)\)//g' \
-e 's/\[\(buildah[^]]*\)\]/\1/g' \
-e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \
-e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \
-e 's/\\$$/ /g' $< | \
$(GOMD2MAN) -in /dev/stdin -out $@
.PHONY: install
install:
install -d ${DESTDIR}/${MANDIR}/man1
install -m 0644 *.1 ${DESTDIR}/${MANDIR}/man1
.PHONY: clean
clean:
$(RM) *.1

45
docs/netavark.1.md Normal file
View File

@@ -0,0 +1,45 @@
% netavark(1)
## NAME
netavark - Configure a given network namespace for use by a container
## SYNOPSIS
**netavark** [*options*] *command* *network namespace path*
## DESCRIPTION
Netavark configures a network namespace according to a configuration read from STDIN. The configuration is JSON formatted.
## GLOBAL OPTIONS
#### **--file**, **-f**
Instead of reading from STDIN, read the configuration to be applied from the given file. **-f -** may also be used to flag reading from STDIN.
## COMMANDS
### netavark setup
The setup command configures the given network namespace with the given configuration, creating any interfaces and firewall rules necessary.
### netavark teardown
The teardown command is the inverse of the setup command, undoing any configuration applied. Some interfaces may not be deleted (bridge interfaces, for example, will not be removed).
### CONFIGURATION FORMAT
The configuration accepted is the same for both setup and teardown. It is JSON formatted.
Format is https://github.com/containers/podman/blob/cd7b48198c38c5028540e85dc72dd3406f4318f0/libpod/network/types/network.go#L164-L173 but we will also send a Networks array including all the network definitions (https://github.com/containers/podman/blob/cd7b48198c38c5028540e85dc72dd3406f4318f0/libpod/network/types/network.go#L32-L62)
TODO: Transcribe configuration into here in a nice tabular format
## EXAMPLE
netavark setup /run/user/1000/podman/netns/d11d1f9c499d
netavark -f /run/podman/828b0508ae64.conf teardown /run/podman/netns/828b0508ae64
## SEE ALSO
podman(1)
## HISTORY
September 2021, Originally compiled by Matt Heon <mheon@redhat.com>