github.com/stackdocker/rkt@v0.10.1-0.20151109095037-1aa827478248/stage1/net/net-install.mk (about)

     1  # Inputs:
     2  #
     3  # NMI_FLAVOR - flavor for which config files should be installed
     4  
     5  # main stamp ensuring that configuration is copied
     6  $(call setup-stamp-file,NMI_COPY_STAMP,$(NMI_FLAVOR)-copy)
     7  
     8  # stamp, a dep file and a filelist for generating dependencies on
     9  # config files
    10  $(call setup-stamp-file,NMI_CONF_DEPS_STAMP,$(NMI_FLAVOR)-deps)
    11  $(call setup-dep-file,NMI_DEPMK,$(NMI_FLAVOR)-conf)
    12  $(call setup-filelist-file,NMI_SRC_CONF_FILELIST,$(NMI_FLAVOR)-conf)
    13  
    14  # stamp for removing the config dir in the ACI rootfs
    15  $(call setup-stamp-file,NMI_CLEAN_DIR_STAMP,$(NMI_FLAVOR)-cleandir)
    16  
    17  # directory with config files in source tree
    18  NMI_SRC_CONFDIR := $(MK_SRCDIR)/conf
    19  NMI_SUFFIX := .conf
    20  NMI_SRC_CONFFILES := $(wildcard $(NMI_SRC_CONFDIR)/*$(NMI_SUFFIX))
    21  
    22  # an etc directory in the ACI rootfs, we expect it to exist
    23  NMI_DIRS_BASE := $(STAGE1_ACIROOTFSDIR_$(NMI_FLAVOR))/etc
    24  # subdirectories of the etc directory created by this Makefile
    25  NMI_DIRS_REST := rkt/net.d
    26  NMI_DIR_CHAIN := $(call dir-chain,$(NMI_DIRS_BASE),$(NMI_DIRS_REST))
    27  NMI_CONFDIR := $(NMI_DIRS_BASE)/$(NMI_DIRS_REST)
    28  # configuration files in the ACI rootfs
    29  NMI_CONFFILES := $(addprefix $(NMI_CONFDIR)/,$(notdir $(NMI_SRC_CONFFILES)))
    30  # triplets for INSTALL_FILES
    31  NMI_TRIPLETS := $(call install-file-triplets,$(NMI_SRC_CONFFILES),$(NMI_CONFFILES),-)
    32  
    33  # this makes sure that config files were copied to the ACI rootfs
    34  $(call generate-stamp-rule,$(NMI_COPY_STAMP),$(NMI_CONFFILES) $(NMI_CONF_DEPS_STAMP))
    35  
    36  # this removes the config directory in the ACI rootfs, will be invalidated
    37  # when something changes in source config files
    38  $(call generate-rm-dir-rule,$(NMI_CLEAN_DIR_STAMP),$(NMI_CONFDIR))
    39  
    40  STAGE1_INSTALL_DIRS_$(NMI_FLAVOR) += $(foreach d,$(NMI_DIR_CHAIN),$d:0755)
    41  STAGE1_INSTALL_FILES_$(NMI_FLAVOR) += $(NMI_TRIPLETS)
    42  STAGE1_SECONDARY_STAMPS_$(NMI_FLAVOR) += $(NMI_COPY_STAMP)
    43  
    44  # This filelist of all config files can be generated any time.
    45  $(call generate-shallow-filelist,$(NMI_SRC_CONF_FILELIST),$(NMI_SRC_CONFDIR),$(NMI_SUFFIX))
    46  # This dep.mk can be generated only after the filelist above was
    47  # generated. Will trigger the removal of the config directory in all
    48  # ACI rootfses if source config files change.
    49  $(call generate-glob-deps,$(NMI_CONF_DEPS_STAMP),$(NMI_CLEAN_DIR_STAMP),$(NMI_DEPMK),$(NMI_SUFFIX),$(NMI_SRC_CONF_FILELIST),$(NMI_SRC_CONFDIR),normal)
    50  
    51  $(call undefine-namespaces,NMI)