github.com/rkt/rkt@v1.30.1-0.20200224141603-171c416fac02/stage1/net/net-install.mk (about)

     1  # Inputs:
     2  #
     3  # NMI_FLAVOR - flavor for which config files should be installed
     4  #
     5  # Copies directory rootfs to the ACI's rootfs
     6  
     7  # main stamp ensuring that configuration is copied
     8  $(call setup-stamp-file,NMI_COPY_STAMP,$(NMI_FLAVOR)-copy)
     9  
    10  # stamp, a dep file and a filelist for generating dependencies on
    11  # config files
    12  $(call setup-stamp-file,NMI_CONF_DEPS_STAMP,$(NMI_FLAVOR)-deps)
    13  $(call setup-dep-file,NMI_DEPMK,$(NMI_FLAVOR)-conf)
    14  $(call setup-filelist-file,NMI_SRC_CONF_FILELIST,$(NMI_FLAVOR)-conf)
    15  
    16  # stamp for removing the config dir in the ACI rootfs
    17  $(call setup-stamp-file,NMI_CLEAN_DIR_STAMP,$(NMI_FLAVOR)-cleandir)
    18  
    19  
    20  # Get source lists
    21  NMI_SRC_DIR := $(MK_SRCDIR)/rootfs
    22  NMI_SRC_FILES := $(call rlist-files,$(NMI_SRC_DIR))
    23  # List of files relative to rootfs
    24  NMI_FILES_REL := $(NMI_SRC_FILES:$(NMI_SRC_DIR)/%=%)
    25  
    26  NMI_SRC_DIRS := $(sort $(dir $(NMI_SRC_FILES)))
    27  NMI_DIRS_REL := $(sort $(NMI_SRC_DIRS:$(NMI_SRC_DIR)/%=%))
    28  # $(info REL $(NMI_DIRS_REL))
    29  
    30  # The ACI rootfs directory
    31  NMI_DST_BASE := $(STAGE1_ACIROOTFSDIR_$(NMI_FLAVOR))
    32  
    33  # Generate lists for INSTALL_FILES and INSTALL_DIRS
    34  NMI_DST_FILES := $(addprefix $(NMI_DST_BASE)/,$(NMI_FILES_REL))
    35  NMI_TRIPLETS := $(call install-file-triplets,$(NMI_SRC_FILES),$(NMI_DST_FILES),0644)
    36  # $(info $$NMI_TRIPLETS is [${NMI_TRIPLETS}])
    37  
    38  NMI_DST_DIRS_CHAIN := $(sort $(foreach d,$(NMI_DIRS_REL),$(call dir-chain,$(NMI_DST_BASE),$d)))
    39  # $(info $$NMI_DST_DIRS_CHAIN is [$(NMI_DST_DIRS_CHAIN)])
    40  
    41  # this makes sure that config files were copied to the ACI rootfs
    42  $(call generate-stamp-rule,$(NMI_COPY_STAMP),$(NMI_DST_FILES) $(NMI_CONF_DEPS_STAMP))
    43  
    44  # this removes the config directory in the ACI rootfs, will be invalidated
    45  # when something changes in source config files
    46  # TODO(CDC) This is no longer the case, as we put some files in rootfs/etc but don't control the dir
    47  # This rule is now disabled
    48  #$(call generate-rm-dir-rule,$(NMI_CLEAN_DIR_STAMP),$(NMI_CONFDIR))
    49  
    50  STAGE1_INSTALL_DIRS_$(NMI_FLAVOR) += $(foreach d,$(NMI_DST_DIRS_CHAIN),$d:0755)
    51  STAGE1_INSTALL_FILES_$(NMI_FLAVOR) += $(NMI_TRIPLETS)
    52  STAGE1_SECONDARY_STAMPS_$(NMI_FLAVOR) += $(NMI_COPY_STAMP)
    53  
    54  # $(info $$STAGE1_INSTALL_DIRS_$(NMI_FLAVOR) is ${STAGE1_INSTALL_DIRS_$(NMI_FLAVOR)} )
    55  
    56  # This filelist of all config files can be generated any time.
    57  $(call generate-deep-filelist,$(NMI_SRC_CONF_FILELIST),$(NMI_SRC_DIR))
    58  # This dep.mk can be generated only after the filelist above was
    59  # generated. Will trigger the removal of the config directory in all
    60  # ACI rootfses if source config files change.
    61  $(call generate-glob-deps,$(NMI_CONF_DEPS_STAMP),$(NMI_CLEAN_DIR_STAMP),$(NMI_DEPMK),,$(NMI_SRC_CONF_FILELIST),$(NMI_SRC_DIR),)
    62  
    63  $(call undefine-namespaces,NMI)