From 06c8d88eb6827d3fabf034716dc9d243aef5c440 Mon Sep 17 00:00:00 2001 From: Jose Carlos Venegas Munoz Date: Fri, 23 Nov 2018 11:29:39 -0600 Subject: [PATCH] makefile: Add make install allow install osbuilder scripts. Example: make install DESTDIR=/tmp/t export DISTRO_REPO=1 export GOPATH=~/go export AGENT_SOURCE_BIN=/tmp/usr/bin/kata-agent /tmp/t/usr/libexec/kata-containers/osbuilder/rootfs-builder/rootfs.sh fedora pushd /tmp/t/usr/libexec/kata-containers/osbuilder/rootfs-builder /tmp/t/usr/libexec/kata-containers/osbuilder/image-builder/image_builder.sh $(pwd)/rootfs-Fedora Fixes: #206 Signed-off-by: Jose Carlos Venegas Munoz --- Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Makefile b/Makefile index ec23eb6548..93a57d13ae 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,40 @@ test-initrd-only: list-distros: @ $(ROOTFS_BUILDER) -l +DESTDIR := / +KATADIR := /usr/libexec/kata-containers +OSBUILDER_DIR := $(KATADIR)/osbuilder +INSTALL_DIR :=$(DESTDIR)/$(OSBUILDER_DIR) +DIST_CONFIGS:= $(wildcard rootfs-builder/*/config.sh) + +SCRIPTS := +SCRIPTS += rootfs-builder/rootfs.sh +SCRIPTS += image-builder/image_builder.sh +SCRIPTS += initrd-builder/initrd_builder.sh + +FILES := +FILES += rootfs-builder/versions.txt +FILES += scripts/lib.sh + +define INSTALL_FILE + echo "Installing $(abspath $2/$1)"; + install -m 644 -D $1 $2/$1; +endef + +define INSTALL_SCRIPT + echo "Installing $(abspath $2/$1)"; + install -m 755 -D $1 $(abspath $2/$1); +endef + +.PHONY: install-scripts +install-scripts: + @echo "Installing scripts" + @$(foreach f,$(SCRIPTS),$(call INSTALL_SCRIPT,$f,$(INSTALL_DIR))) + @echo "Installing helper files" + @$(foreach f,$(FILES),$(call INSTALL_FILE,$f,$(INSTALL_DIR))) + @echo "Installing installing config files" + @$(foreach f,$(DIST_CONFIGS),$(call INSTALL_FILE,$f,$(INSTALL_DIR))) + .PHONY: clean clean: rm -rf $(DISTRO_ROOTFS_MARKER) $(DISTRO_ROOTFS) $(DISTRO_IMAGE) $(DISTRO_INITRD)