diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2016-03-31 02:20:11 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-31 23:01:37 +0100 |
commit | aa13b972860c82d32a6e44903c07e35afea27d1e (patch) | |
tree | 56319187f8536c4291e8f11362c9f3f933f21eab /meta/lib | |
parent | 4dde12f17b5c0e8b029272284b9013cdef5ccd60 (diff) | |
download | poky-aa13b972860c82d32a6e44903c07e35afea27d1e.tar.gz |
image.bbclass: Make unneeded packages for a read-only rootfs configurable
Previously the list of packages that are considered unneeded for a
read-only rootfs was hardcoded. This made it impossible to, e.g., have
shadow installed on a system with a read-only rootfs, but where /etc
is mounted writable.
This also lists ${VIRTUAL-RUNTIME_update-alternatives} rather than
update-alternatives (as was previously the case) since this should
actually remove the intended package.
(From OE-Core rev: e3b881d4168e5b02ff00f5c470ba472ab8bbc747)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/rootfs.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 0f835d311b..bfae1d8e89 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -238,28 +238,13 @@ class Rootfs(object): | |||
238 | self.d.getVar('IMAGE_ROOTFS', True), | 238 | self.d.getVar('IMAGE_ROOTFS', True), |
239 | "run-postinsts", "remove"]) | 239 | "run-postinsts", "remove"]) |
240 | 240 | ||
241 | runtime_pkgmanage = bb.utils.contains("IMAGE_FEATURES", "package-management", | ||
242 | True, False, self.d) | ||
243 | sysvcompat_in_distro = bb.utils.contains("DISTRO_FEATURES", [ "systemd", "sysvinit" ], | ||
244 | True, False, self.d) | ||
245 | image_rorfs = bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", | 241 | image_rorfs = bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", |
246 | True, False, self.d) | 242 | True, False, self.d) |
247 | if sysvcompat_in_distro and not image_rorfs: | ||
248 | pkg_to_remove = "" | ||
249 | else: | ||
250 | pkg_to_remove = "update-rc.d" | ||
251 | if image_rorfs: | 243 | if image_rorfs: |
252 | # Remove components that we don't need if it's a read-only rootfs | 244 | # Remove components that we don't need if it's a read-only rootfs |
245 | unneeded_pkgs = self.d.getVar("ROOTFS_RO_UNNEEDED", True).split() | ||
253 | pkgs_installed = image_list_installed_packages(self.d) | 246 | pkgs_installed = image_list_installed_packages(self.d) |
254 | pkgs_to_remove = list() | 247 | pkgs_to_remove = [pkg for pkg in pkgs_installed if pkg in unneeded_pkgs] |
255 | for pkg in pkgs_installed: | ||
256 | if pkg in ["update-rc.d", | ||
257 | "base-passwd", | ||
258 | "shadow", | ||
259 | "update-alternatives", pkg_to_remove, | ||
260 | self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True) | ||
261 | ]: | ||
262 | pkgs_to_remove.append(pkg) | ||
263 | 248 | ||
264 | if len(pkgs_to_remove) > 0: | 249 | if len(pkgs_to_remove) > 0: |
265 | self.pm.remove(pkgs_to_remove, False) | 250 | self.pm.remove(pkgs_to_remove, False) |
@@ -273,6 +258,8 @@ class Rootfs(object): | |||
273 | post_uninstall_cmds = self.d.getVar("ROOTFS_POSTUNINSTALL_COMMAND", True) | 258 | post_uninstall_cmds = self.d.getVar("ROOTFS_POSTUNINSTALL_COMMAND", True) |
274 | execute_pre_post_process(self.d, post_uninstall_cmds) | 259 | execute_pre_post_process(self.d, post_uninstall_cmds) |
275 | 260 | ||
261 | runtime_pkgmanage = bb.utils.contains("IMAGE_FEATURES", "package-management", | ||
262 | True, False, self.d) | ||
276 | if not runtime_pkgmanage: | 263 | if not runtime_pkgmanage: |
277 | # Remove the package manager data files | 264 | # Remove the package manager data files |
278 | self.pm.remove_packaging_data() | 265 | self.pm.remove_packaging_data() |