public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v5] image: make sure do_rootfs_finalize can run multiple times, v5
@ 2023-01-14 23:31 roberto.foglietta
  0 siblings, 0 replies; only message in thread
From: roberto.foglietta @ 2023-01-14 23:31 UTC (permalink / raw)
  To: isar-users; +Cc: roberto.foglietta

From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>

image, bugfix: make sure do_rootfs_finalize can run multiple times

The rootfs_finalize task currently cannot be re-executed, as it moves
the sources-list into bootstrap.list. As this only has to be done once,
it is not required on subsequent executions. To fix the rebuild issue,
we simply ignore the return code of the mv statement.

v2: essential code, only

v3: rationalisation of the code above the fix

v4: like v3 but with the description provided by Felix Moessbauer

v5: rationalisation of the code above the fix using 'cd $dir' + 'cd -'

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 meta/classes/image.bbclass | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 629a0c1..4605d4f 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -419,15 +419,13 @@ do_rootfs_finalize() {
         mountpoint -q '${ROOTFSDIR}/sys' && \
             umount -l ${ROOTFSDIR}/sys
 
-        rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list"
-        rm -f "${ROOTFSDIR}/etc/apt/preferences.d/isar-apt"
-        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"
+        cd "${ROOTFSDIR}/etc/apt"
+        rm -f "apt.conf.d/50isar"
+        rm -f "preferences.d/isar-apt"
+        rm -f "sources.list.d/isar-apt.list"
+        rm -f "sources.list.d/base-apt.list"
+        mv -f "sources-list" "sources.list.d/bootstrap.list" 2>/dev/null ||:
+        cd -
 EOSUDO
 }
 addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-14 23:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-14 23:31 [PATCH v5] image: make sure do_rootfs_finalize can run multiple times, v5 roberto.foglietta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox