mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
build: put install methods in utils.mk
put install methods in utils.mk to avoid duplication Fixes: #4379 Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
parent
8a697268d0
commit
242992e3de
@ -250,6 +250,9 @@ USER_VARS += RUNTIMENAME
|
||||
USER_VARS += HYPERVISOR_DB
|
||||
USER_VARS += PIPESIZE
|
||||
USER_VARS += DBSHAREDFS
|
||||
USER_VARS += KATA_INSTALL_GROUP
|
||||
USER_VARS += KATA_INSTALL_OWNER
|
||||
USER_VARS += KATA_INSTALL_CFG_PERMS
|
||||
|
||||
SOURCES := \
|
||||
$(shell find . 2>&1 | grep -E '.*\.rs$$') \
|
||||
@ -318,10 +321,6 @@ define INSTALL_FILE
|
||||
install -D -m 644 $1 $(DESTDIR)$2/$1 || exit 1;
|
||||
endef
|
||||
|
||||
define INSTALL_CONFIG
|
||||
sudo install --mode 0644 -D $1 $(DESTDIR)$2/$(notdir $1);
|
||||
endef
|
||||
|
||||
# Returns the name of the kernel file to use based on the provided KERNELTYPE.
|
||||
# $1 : KERNELTYPE (compressed or uncompressed)
|
||||
define MAKE_KERNEL_NAME
|
||||
|
42
utils.mk
42
utils.mk
@ -3,6 +3,23 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# Note:
|
||||
#
|
||||
# Since this file defines rules, it should be included
|
||||
# in other makefiles *after* their default rule has been defined.
|
||||
|
||||
# Owner for installed files
|
||||
export KATA_INSTALL_OWNER ?= root
|
||||
|
||||
# Group for installed files
|
||||
export KATA_INSTALL_GROUP ?= adm
|
||||
|
||||
# Permissions for installed configuration files.
|
||||
#
|
||||
# XXX: Note that the permissions MUST be zero for "other"
|
||||
# XXX: in case the configuration file contains secrets.
|
||||
export KATA_INSTALL_CFG_PERMS ?= 0640
|
||||
|
||||
# Create a set of standard rules for a project such that:
|
||||
#
|
||||
# - The component depends on its Makefile.
|
||||
@ -160,3 +177,28 @@ standard_rust_check:
|
||||
cargo clippy --all-targets --all-features --release \
|
||||
-- \
|
||||
-D warnings
|
||||
|
||||
# Install a file (full version).
|
||||
#
|
||||
# params:
|
||||
#
|
||||
# $1 : File to install.
|
||||
# $2 : Directory path where file will be installed.
|
||||
# $3 : Permissions to apply to the installed file.
|
||||
define INSTALL_FILE_FULL
|
||||
sudo install \
|
||||
--mode $3 \
|
||||
--owner $(KATA_INSTALL_OWNER) \
|
||||
--group $(KATA_INSTALL_GROUP) \
|
||||
-D $1 $2/$(notdir $1) || exit 1;
|
||||
endef
|
||||
|
||||
# Install a configuration file.
|
||||
#
|
||||
# params:
|
||||
#
|
||||
# $1 : File to install.
|
||||
# $2 : Directory path where file will be installed.
|
||||
define INSTALL_CONFIG
|
||||
$(call INSTALL_FILE_FULL,$1,$2,$(KATA_INSTALL_CFG_PERMS))
|
||||
endef
|
Loading…
Reference in New Issue
Block a user