mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 08:28:34 +00:00
Merge pull request #207 from jcvenegas/install
Add 'install' target to makefile
This commit is contained in:
34
Makefile
34
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)
|
||||
|
@@ -16,6 +16,7 @@ AGENT_BIN=${AGENT_BIN:-kata-agent}
|
||||
AGENT_INIT=${AGENT_INIT:-no}
|
||||
KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""}
|
||||
OSBUILDER_VERSION="unknown"
|
||||
export GOPATH=${GOPATH:-${HOME}/go}
|
||||
|
||||
lib_file="${script_dir}/../scripts/lib.sh"
|
||||
source "$lib_file"
|
||||
@@ -78,6 +79,9 @@ AGENT_SOURCE_BIN Path to the directory of agent binary.
|
||||
If set, use the binary as agent but not build agent package.
|
||||
Default value: <not set>
|
||||
|
||||
DISTRO_REPO Use host repositories to install guest packages.
|
||||
Default value: <not set>
|
||||
|
||||
GO_AGENT_PKG URL of the Git repository hosting the agent package.
|
||||
Default value: ${GO_AGENT_PKG}
|
||||
|
||||
@@ -356,6 +360,11 @@ fi
|
||||
|
||||
mkdir -p ${ROOTFS_DIR}
|
||||
build_rootfs ${ROOTFS_DIR}
|
||||
pushd "${ROOTFS_DIR}" >> /dev/null
|
||||
if [ "$PWD" != "/" ] ; then
|
||||
rm -rf ./var/cache/dnf/
|
||||
fi
|
||||
popd >> /dev/null
|
||||
|
||||
[ -n "${KERNEL_MODULES_DIR}" ] && copy_kernel_modules ${KERNEL_MODULES_DIR} ${ROOTFS_DIR}
|
||||
|
||||
|
@@ -47,7 +47,7 @@ check_root()
|
||||
generate_dnf_config()
|
||||
{
|
||||
REPO_NAME=${REPO_NAME:-"base"}
|
||||
CACHE_DIR=${CACHE_DIR:-"/var/cache/dnf-${OS_NAME}"}
|
||||
CACHE_DIR=${CACHE_DIR:-"/var/cache/dnf"}
|
||||
cat > "${DNF_CONF}" << EOF
|
||||
[main]
|
||||
cachedir=${CACHE_DIR}
|
||||
@@ -118,7 +118,7 @@ build_rootfs()
|
||||
#local CONFIG_DIR=${CONFIG_DIR}
|
||||
|
||||
check_root
|
||||
if [ ! -f "${DNF_CONF}" ]; then
|
||||
if [ ! -f "${DNF_CONF}" ] && [ -z "${DISTRO_REPO}" ] ; then
|
||||
DNF_CONF="./kata-${OS_NAME}-dnf.conf"
|
||||
generate_dnf_config
|
||||
fi
|
||||
@@ -133,10 +133,13 @@ build_rootfs()
|
||||
die "neither yum nor dnf is installed"
|
||||
fi
|
||||
|
||||
DNF="${PKG_MANAGER} --config=$DNF_CONF -y --installroot=${ROOTFS_DIR} --noplugins"
|
||||
DNF="${PKG_MANAGER} -y --installroot=${ROOTFS_DIR} --noplugins"
|
||||
if [ -n "${DNF_CONF}" ] ; then
|
||||
DNF="${DNF} --config=${DNF_CONF}"
|
||||
else
|
||||
DNF="${DNF} --releasever=${OS_VERSION}"
|
||||
fi
|
||||
$DNF install ${EXTRA_PKGS} ${PACKAGES}
|
||||
|
||||
[ -n "${ROOTFS_DIR}" ] && rm -r "${ROOTFS_DIR}${CACHE_DIR}"
|
||||
}
|
||||
|
||||
# Create a YAML metadata file inside the rootfs.
|
||||
|
Reference in New Issue
Block a user