1# When inherited by an image recipe, this class provide simple way to 2# put configuration files into rootfs. 3 4ROOTFS_POSTPROCESS_COMMAND_append = "install_google_overlay ; " 5 6python install_google_overlay() { 7 """Fetch and install overlays into rootfs 8 9 Fetch overlays from GOOGLE_OVERLAY_SRC_URI and copy the files 10 inside the folders listed in GOOGLE_OVERLAY_ROOT_DIRS to rootfs. 11 12 GOOGLE_OVERLAY_ROOT_DIRS contains only names of folders, no path. 13 14 GOOGLE_OVERLAY_SRC_URI must be used to get dirs in GOOGLE_OVERLAY_ROOT_DIRS 15 imported to the workdir, it's the same as SRC_URI, so it's 16 possible to use distant repository, tarballs, etc. 17 """ 18 workdir = d.getVar('WORKDIR', True) 19 rootfs = d.getVar('IMAGE_ROOTFS', True) 20 srcs = (d.getVar("GOOGLE_OVERLAY_SRC_URI", True) or "").split() 21 overlay_root_dirs = (d.getVar('GOOGLE_OVERLAY_ROOT_DIRS', True) or '').split() 22 23 fetcher = bb.fetch2.Fetch(srcs, d) 24 fetcher.download() 25 fetcher.unpack(workdir) 26 27 for i in range(len(overlay_root_dirs)): 28 fullpath = os.path.join(workdir, overlay_root_dirs[i]) 29 30 if not os.path.isdir(fullpath): 31 bb.fatal(fullpath + 32 " : directory not found, please check your"\ 33 " GOOGLE_OVERLAY_ROOT_DIRS and GOOGLE_OVERLAY_SRC_URI variables.") 34 break 35 os.system("cp -dr " + os.path.join(fullpath, "*") + " " + rootfs) 36} 37 38do_rootfs[vardeps] += "GOOGLE_OVERLAY_ROOT_DIRS GOOGLE_OVERLAY_SRC_URI" 39 40# Copied from https://patchwork.openembedded.org/patch/138100/ 41