From b11f8183074857be5a5920f093b4298884eec805 Mon Sep 17 00:00:00 2001 From: Laurentiu Palcu Date: Tue, 21 May 2013 14:17:19 +0300 Subject: rootfs_*.bbclass: add some helper functions This patch adds the following helper functions: * delayed_postinsts - outputs the list of delayed postinstalls; * save_postinsts - this will save the delayed postinstalls for ipk/deb in /etc/(ipk|deb)_postinsts; * rootfs_remove_packages - removes packages from an image; Additionaly, this patch will remove a piece of code in rootfs_ipk_do_rootfs which will be moved to image.bbclass and used for all backends; [YOCTO #4484] (From OE-Core rev: 928df79cd3964f775c4c6e4283ef84b8882f9328) Signed-off-by: Laurentiu Palcu Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/classes/rootfs_deb.bbclass | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'meta/classes/rootfs_deb.bbclass') diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass index e642cf3852..edd1037f87 100644 --- a/meta/classes/rootfs_deb.bbclass +++ b/meta/classes/rootfs_deb.bbclass @@ -85,7 +85,7 @@ fakeroot rootfs_deb_do_rootfs () { ${ROOTFS_POSTPROCESS_COMMAND} if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then - if grep Status:.install.ok.unpacked ${IMAGE_ROOTFS}/var/lib/dpkg/status; then + if [ -n "$(delayed_postinsts)" ]; then bberror "Some packages could not be configured offline and rootfs is read-only." exit 1 fi @@ -94,9 +94,22 @@ fakeroot rootfs_deb_do_rootfs () { log_check rootfs } +rootfs_deb_do_rootfs[vardeps] += "delayed_postinsts" + +delayed_postinsts () { + cat ${IMAGE_ROOTFS}/var/lib/dpkg/status|grep -e "^Package:" -e "^Status:"|sed -ne 'N;s/Package: \(.*\)\nStatus:.*unpacked/\1/p' +} + +save_postinsts () { + for p in $(delayed_postinsts); do + install -d ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts + cp ${IMAGE_ROOTFS}/var/lib/dpkg/info/$p.postinst ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts/$p + done +} + remove_packaging_data_files() { rm -rf ${IMAGE_ROOTFS}${opkglibdir} - rm -rf ${IMAGE_ROOTFS}/usr/dpkg/ + rm -rf ${IMAGE_ROOTFS}/var/lib/dpkg/ } rootfs_install_packages() { @@ -105,3 +118,9 @@ rootfs_install_packages() { # Mark all packages installed sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" $INSTALL_ROOTFS_DEB/var/lib/dpkg/status } + +rootfs_remove_packages() { + # for some reason, --root doesn't really work here... We use --admindir&--instdir instead. + ${STAGING_BINDIR_NATIVE}/dpkg --admindir=${IMAGE_ROOTFS}/var/lib/dpkg --instdir=${IMAGE_ROOTFS} -r --force-depends $@ +} + -- cgit v1.2.3-54-g00ecf