From b727a22b9598fefcf7794f73cd27fddb1671a4fc Mon Sep 17 00:00:00 2001 From: Sn0rt Date: Thu, 1 Dec 2016 17:45:32 +0800 Subject: [PATCH] README.md: how to install image-tools Signed-off-by: Sn0rt --- Makefile | 22 ++++++++++++++++++- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f0f35f7..8e97ed7 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,10 @@ TOOLS := \ oci-create-runtime-bundle \ oci-image-validate \ oci-unpack +MAN := \ + oci-create-runtime-bundle.1 \ + oci-image-validate.1 \ + oci-unpack.1 default: help @@ -15,6 +19,7 @@ help: @echo "Usage: make " @echo @echo " * 'tools' - Build the oci image tools binaries" + @echo " * 'install' - Install binary" @echo " * 'check-license' - Check license headers in source files" @echo " * 'lint' - Execute the source code linter" @echo " * 'test' - Execute the unit tests" @@ -29,6 +34,21 @@ tools: $(TOOLS) $(TOOLS): oci-%: go build -ldflags "-X main.gitCommit=${COMMIT}" ./cmd/$@ +.PHONY: man install uninstall + +_man: + go-md2man -in "cmd/oci-unpack/oci-unpack.1.md" -out "oci-unpack.1" + go-md2man -in "cmd/oci-image-validate/oci-image-validate.1.md" -out "oci-image-validate.1" + go-md2man -in "cmd/oci-create-runtime-bundle/oci-create-runtime-bundle.1.md" -out "oci-create-runtime-bundle.1" + +install: _man + install -m 755 $(TOOLS) /usr/local/bin/ + install -m 644 $(MAN) /usr/local/share/man/man1 + +uninstall: clean + rm -f /usr/local/share/man/man1/oci-create-runtime-bundle.1 /usr/local/share/man/man1/oci-image-validate.1 /usr/local/share/man/man1/oci-unpack.1 + rm -f /usr/local/bin/oci-create-runtime-bundle /usr/local/bin/oci-image-validate /usr/local/bin/oci-unpack + lint: @echo "checking lint" @./.tool/lint @@ -73,7 +93,7 @@ install.tools: .install.gitvalidation .install.glide .install.glide-vc .install. gometalinter --install --update clean: - rm -rf *~ $(OUTPUT_DIRNAME) $(TOOLS) + rm -rf *~ $(OUTPUT_DIRNAME) $(TOOLS) $(MAN) .PHONY: \ tools \ diff --git a/README.md b/README.md index 5698daf..925eb47 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,72 @@ `image-tools` is a collection of tools for working with the [OCI image format specification](https://github.com/opencontainers/image-spec). +# Install + +Recommend to use `go` to download. + +``` +$ go get github.com/opencontainers/image-tools/ +$ cd $GOPATH/src/github.com/opencontainers/image-tools/ +$ make tools +$ sudo make install +``` + +## uninstall + +``` +$ sudo make uninstall +``` + +## example + +Firstly, May be you need to install `skopeo` and more information at [here](https://github.com/projectatomic/skopeo). + +And now skopeo is available from Fedora 23: + +``` +$ sudo dnf install skopeo +``` + +### oci-create-runtime-bundle + +more information about `oci-create-runtime-bundle` can be found [here](./cmd/oci-create-runtime-bundle/oci-create-runtime-bundle.1.md) + +``` +$ skopeo copy docker://busybox oci:busybox-oci +$ mkdir busybox-bundle +$ oci-create-runtime-bundle --ref latest busybox-oci busybox-bundle +$ cd busybox-bundle && sudo runc run busybox +``` + +### oci-image-validate + +more information about `oci-image-validate` can be found [here](./cmd/oci-image-validate/oci-image-validate.1.md) + +``` +$ skopeo copy docker://busybox oci:busybox-oci +$ oci-image-validate --type imageLayout --ref latest busybox-oci +busybox-oci: OK +``` + +### oci-unpack + +more information about `oci-unpack` can be found [here](./cmd/oci-unpack/oci-unpack.1.md) + +``` +$ skopeo copy docker://busybox oci:busybox-oci +$ mkdir busybox-bundle +$ oci-unpack --ref latest busybox-oci busybox-bundle +tree busybox-bundle +busybox-bundle +├── bin +│   ├── [ +│   ├── [[ +│   ├── acpid +│   ├── addgroup +│   ├── add-shell +[...] +``` # Contributing Development happens on GitHub. Issues are used for bugs and actionable items and longer discussions can happen on the [mailing list](#mailing-list).