rootfs.py: Allow to override postinst-intercepts location
PATCH 1/3 rootfs.py: Allow to override postinst-intercepts location
From: Martin Jansa <[email protected]>
* useful when we need to overlay/extend intercept scripts from oe-core
Signed-off-by Martin Jansa <[email protected]>
Signed-off-by Richard Purdie <[email protected]>
--- meta/lib/oe/rootfs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
meta/lib/oe/rootfs.py +4 -2
@@ -77,6 +77,9 @@ class Rootfs(object): pre_process_cmds = self.d.getVar("ROOTFS_PREPROCESS_COMMAND", True) post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND", True) + postinst_intercepts_dir = self.d.getVar("POSTINST_INTERCEPTS_DIR", True) + if not postinst_intercepts_dir: + postinst_intercepts_dir = self.d.expand("${COREBASE}/scripts/postinst-intercepts") intercepts_dir = os.path.join(self.d.getVar('WORKDIR', True), "intercept_scripts")
@@ -86,8 +89,7 @@ class Rootfs(object): bb.utils.mkdirhier(self.deploy_dir_image) - shutil.copytree(self.d.expand("${COREBASE}/scripts/postinst-intercepts"), - intercepts_dir) + shutil.copytree(postinst_intercepts_dir, intercepts_dir) shutil.copy(self.d.expand("${COREBASE}/meta/files/deploydir_readme.txt"), self.deploy_dir_image +
Signature · 1 line
2.5.1
PATCH 2/3 rootfs.py: show intercept script output in log.do_rootfs
From: Martin Jansa <[email protected]>
* without this the output wasn't shown anywhere even when the bb.warn says:
"See log for details!"
Signed-off-by Martin Jansa <[email protected]>
Signed-off-by Richard Purdie <[email protected]>
--- meta/lib/oe/rootfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/rootfs.py +1 -1
@@ -183,7 +183,7 @@ class Rootfs(object): bb.note("> Executing %s intercept ..." % script) try: - subprocess.check_output(script_full) + subprocess.check_call(script_full) except subprocess.CalledProcessError as e: bb.warn("The postinstall intercept hook '%s' failed (exit code: %d)! See log for details!" % (script, e.returncode))
Signature · 1 line
2.5.1
PATCH 3/3 postinst_intercept: allow to pass variables with spaces
In reply to Martin JansaFrom: Martin Jansa <[email protected]>
* trying to pass foo="a b" through postinst_intercept ends with the actual script header to containing:
b
foo=a
which fails because "b" command doesn't exist.
Signed-off-by Martin Jansa <[email protected]>
Signed-off-by Richard Purdie <[email protected]>
--- scripts/postinst-intercepts/postinst_intercept | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/postinst-intercepts/postinst_intercept +1 -1
@@ -48,7 +48,7 @@ if [ -n "$pkgs_line" ]; then sed -i -e "s/##PKGS:.*/\0${package_name} /" $intercept_script fi else - for var in $@; do + for var in "$@"; do sed -i -e "\%^#\!/bin/.*sh%a $var" $intercept_script done echo "##PKGS: ${package_name} " >> $intercept_script
Signature · 1 line
2.5.1