diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2017-09-15 16:48:59 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-18 11:07:30 +0100 |
commit | 1b0e9f8534acff5e9e6c3847e70af810e27edefc (patch) | |
tree | 10b699c0612ba2bb0d1b0f8c729568eb8fdec192 | |
parent | 2c8cc36f240fca72b84d2b9cabb82faf2fa7f810 (diff) | |
download | poky-1b0e9f8534acff5e9e6c3847e70af810e27edefc.tar.gz |
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>
-rw-r--r-- | meta/classes/useradd.bbclass | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass index 0f51e5522b..686e5fbefe 100644 --- a/meta/classes/useradd.bbclass +++ b/meta/classes/useradd.bbclass | |||
@@ -138,22 +138,19 @@ useradd_sysroot () { | |||
138 | EXTRA_STAGING_FIXMES += "COMPONENTS_DIR" | 138 | EXTRA_STAGING_FIXMES += "COMPONENTS_DIR" |
139 | 139 | ||
140 | python useradd_sysroot_sstate () { | 140 | python useradd_sysroot_sstate () { |
141 | scriptfile = None | ||
141 | task = d.getVar("BB_CURRENTTASK") | 142 | task = d.getVar("BB_CURRENTTASK") |
142 | if task == "package_setscene": | 143 | if task == "package_setscene": |
143 | bb.build.exec_func("useradd_sysroot", d) | 144 | bb.build.exec_func("useradd_sysroot", d) |
144 | elif task == "prepare_recipe_sysroot": | 145 | elif task == "prepare_recipe_sysroot": |
145 | # Used to update this recipe's own sysroot so the user/groups are available to do_install | 146 | # Used to update this recipe's own sysroot so the user/groups are available to do_install |
146 | scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}") | 147 | scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}") |
147 | bb.utils.mkdirhier(os.path.dirname(scriptfile)) | ||
148 | with open(scriptfile, 'w') as script: | ||
149 | script.write("#!/bin/sh\n") | ||
150 | bb.data.emit_func("useradd_sysroot", script, d) | ||
151 | script.write("useradd_sysroot\n") | ||
152 | os.chmod(scriptfile, 0o755) | ||
153 | bb.build.exec_func("useradd_sysroot", d) | 148 | bb.build.exec_func("useradd_sysroot", d) |
154 | elif task == "populate_sysroot": | 149 | elif task == "populate_sysroot": |
155 | # Used when installed in dependent task sysroots | 150 | # Used when installed in dependent task sysroots |
156 | scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}") | 151 | scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}") |
152 | |||
153 | if scriptfile: | ||
157 | bb.utils.mkdirhier(os.path.dirname(scriptfile)) | 154 | bb.utils.mkdirhier(os.path.dirname(scriptfile)) |
158 | with open(scriptfile, 'w') as script: | 155 | with open(scriptfile, 'w') as script: |
159 | script.write("#!/bin/sh\n") | 156 | script.write("#!/bin/sh\n") |