mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
useradd.bbclass: Unify writing of script file in useradd_sysroot_sstate()
There were two identical code blocks for writing the
postinst-useradd-${PN} scripts. This combines them into one.
(From OE-Core rev: 0c4259dd3c74d81f20b87417cecb1e636365ce10)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
2c8cc36f24
commit
1b0e9f8534
@@ -138,22 +138,19 @@ useradd_sysroot () {
|
|||||||
EXTRA_STAGING_FIXMES += "COMPONENTS_DIR"
|
EXTRA_STAGING_FIXMES += "COMPONENTS_DIR"
|
||||||
|
|
||||||
python useradd_sysroot_sstate () {
|
python useradd_sysroot_sstate () {
|
||||||
|
scriptfile = None
|
||||||
task = d.getVar("BB_CURRENTTASK")
|
task = d.getVar("BB_CURRENTTASK")
|
||||||
if task == "package_setscene":
|
if task == "package_setscene":
|
||||||
bb.build.exec_func("useradd_sysroot", d)
|
bb.build.exec_func("useradd_sysroot", d)
|
||||||
elif task == "prepare_recipe_sysroot":
|
elif task == "prepare_recipe_sysroot":
|
||||||
# Used to update this recipe's own sysroot so the user/groups are available to do_install
|
# Used to update this recipe's own sysroot so the user/groups are available to do_install
|
||||||
scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}")
|
scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}")
|
||||||
bb.utils.mkdirhier(os.path.dirname(scriptfile))
|
|
||||||
with open(scriptfile, 'w') as script:
|
|
||||||
script.write("#!/bin/sh\n")
|
|
||||||
bb.data.emit_func("useradd_sysroot", script, d)
|
|
||||||
script.write("useradd_sysroot\n")
|
|
||||||
os.chmod(scriptfile, 0o755)
|
|
||||||
bb.build.exec_func("useradd_sysroot", d)
|
bb.build.exec_func("useradd_sysroot", d)
|
||||||
elif task == "populate_sysroot":
|
elif task == "populate_sysroot":
|
||||||
# Used when installed in dependent task sysroots
|
# Used when installed in dependent task sysroots
|
||||||
scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}")
|
scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}")
|
||||||
|
|
||||||
|
if scriptfile:
|
||||||
bb.utils.mkdirhier(os.path.dirname(scriptfile))
|
bb.utils.mkdirhier(os.path.dirname(scriptfile))
|
||||||
with open(scriptfile, 'w') as script:
|
with open(scriptfile, 'w') as script:
|
||||||
script.write("#!/bin/sh\n")
|
script.write("#!/bin/sh\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user