public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH] isar-bootstrap: Run setup-chroot.sh after dpkg upgraded
Date: Mon, 28 Oct 2024 10:32:24 +0300	[thread overview]
Message-ID: <20241028073231.14162-1-ubely@ilbers.de> (raw)

By calling "chroot-setup.sh setup" right after debootstrap we do
dpkg-divert for `/usr/sbin/start-stop-daemon`. This replaces the
original script with a stub that is called during the build. At
the end of the build, in "rootfs_finalize" task for target image,
the original file is restored so package installation on a real
target should be full-functional.

But if `apt-get update` followed by debootstrap stage requires an
upgrade of "dpkg" package itself (e.g. if new version exists in
"<distro>-updates"), this may lead for diversion reset and original
script gets restored.

This results in following things:
 - "real" start-stop-daemon is called in all chroots during build;
 - start-stop-daemon is removed on target rootfs by "rootfs_finalize".

Currently, it happens only for rpi-bookworm targets where debootsrapped
"dpkg_1.21.22_arm64.deb" package is upgraded with a newer version
"dpkg_1.22.6~bpo12+rpt3_arm64.deb" at "apt-get update" stage.

With this change, we run "chroot-setup.sh" after explicite upgrade of
"dpkg". Thus we guarantee start-stop-daemon stub is used during build
and undirsion is done only at the end of the rootfs creation.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 92974eb5..e155aade 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -370,10 +370,6 @@ do_bootstrap() {
         sed -i '/en_US.UTF-8 UTF-8/s/^#//g' "${ROOTFSDIR}/etc/locale.gen"
         chroot "${ROOTFSDIR}" /usr/sbin/locale-gen
 
-        # setup chroot
-        install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh"
-        "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
-
         # update APT
         mount -o bind,private /dev ${ROOTFSDIR}/dev
         mount -o bind,private /dev/pts "${ROOTFSDIR}/dev/pts"
@@ -394,6 +390,13 @@ do_bootstrap() {
 
         chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y \
                                 -o APT::Update::Error-Mode=any
+
+        chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y dpkg
+
+        # setup chroot
+        install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh"
+        "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
+
         chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y -f
         chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
                                 -o Debug::pkgProblemResolver=yes
-- 
2.45.2

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241028073231.14162-1-ubely%40ilbers.de.

             reply	other threads:[~2024-10-28  7:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28  7:32 Uladzimir Bely [this message]
2024-11-04 13:53 ` Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241028073231.14162-1-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox