From: Henning Schild <henning.schild@siemens.com>
To: <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH] image: make sure do_rootfs_finalize can run multiple times
Date: Thu, 5 Jan 2023 19:43:28 +0100 [thread overview]
Message-ID: <20230105184328.25277-1-henning.schild@siemens.com> (raw)
There have been several places that would not work twice in a row. All
the test && not covering || have been moved to if. The rm at the end
tried to remove a file that was just moved. And that mv would not work a
second time because its source would be gone.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/image.bbclass | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 629a0c1daa55..125eba192a65 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -396,13 +396,16 @@ addtask deploy before do_build after do_image
do_rootfs_finalize() {
sudo -s <<'EOSUDO'
set -e
- test -e "${ROOTFSDIR}/chroot-setup.sh" && \
+
+ if [ -e "${ROOTFSDIR}/chroot-setup.sh" ]; then
"${ROOTFSDIR}/chroot-setup.sh" "cleanup" "${ROOTFSDIR}"
+ fi
rm -f "${ROOTFSDIR}/chroot-setup.sh"
- test ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" && \
+ if [ ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" ]; then
find "${ROOTFSDIR}/usr/bin" \
-maxdepth 1 -name 'qemu-*-static' -type f -delete
+ fi
mountpoint -q '${ROOTFSDIR}/isar-apt' && \
umount -l ${ROOTFSDIR}/isar-apt && \
@@ -424,10 +427,10 @@ do_rootfs_finalize() {
rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar"
- mv "${ROOTFSDIR}/etc/apt/sources-list" \
- "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
-
- rm -f "${ROOTFSDIR}/etc/apt/sources-list"
+ if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
+ mv "${ROOTFSDIR}/etc/apt/sources-list" \
+ "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
+ fi
EOSUDO
}
addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
--
2.38.2
next reply other threads:[~2023-01-05 18:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 18:43 Henning Schild [this message]
2023-01-06 18:19 ` Henning Schild
2023-01-07 2:27 ` Roberto A. Foglietta
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=20230105184328.25277-1-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--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