diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh index 9283519ca3..febeb154e5 100755 --- a/build_library/base_image_util.sh +++ b/build_library/base_image_util.sh @@ -209,9 +209,10 @@ create_base_image() { emerge_to_image --root="${root_fs_dir}" ${BASE_PACKAGE} # Record directories installed to the stateful partition. + # Ignore /var/tmp, systemd covers this entry. sudo "${SCRIPTS_DIR}/gen_tmpfiles.py" --root="${root_fs_dir}" \ --output="${root_fs_dir}/usr/lib/tmpfiles.d/base_image.conf" \ - "${root_fs_dir}/var" + --ignore=/var/tmp "${root_fs_dir}/var" # Set /etc/lsb-release on the image. "${BUILD_LIBRARY_DIR}/set_lsb_release" \ diff --git a/gen_tmpfiles.py b/gen_tmpfiles.py index 5d96f12c16..b52ff8697b 100755 --- a/gen_tmpfiles.py +++ b/gen_tmpfiles.py @@ -19,6 +19,8 @@ def main(): parser = optparse.OptionParser(description=__doc__) parser.add_option('--root', help='Remove root prefix from output') parser.add_option('--output', help='Write output to the given file') + parser.add_option('--ignore', action='append', default=[], + help='Ignore one or more paths (use multiple times)') opts, args = parser.parse_args() if opts.root: @@ -56,6 +58,9 @@ def main(): else: stripped = path + if stripped in opts.ignore: + continue + info = os.stat(path) assert stat.S_ISDIR(info.st_mode) mode = stat.S_IMODE(info.st_mode)