From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7010687509260664832 X-Received: by 2002:a19:c3d3:: with SMTP id t202mr26965180lff.678.1632302898485; Wed, 22 Sep 2021 02:28:18 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6512:324d:: with SMTP id c13ls378952lfr.0.gmail; Wed, 22 Sep 2021 02:28:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiyl6ljC3ZFFWRt15dikjKVm0DIqqVI/f6YTmARzENVZGykKA6oNpHtySZRbSpbynrFCB2 X-Received: by 2002:a05:6512:750:: with SMTP id c16mr27977600lfs.21.1632302897594; Wed, 22 Sep 2021 02:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632302897; cv=none; d=google.com; s=arc-20160816; b=fpQWXsgybRqZL/9DPmZhhLLALuUKGuF0xKvFPVSp8oHbN/stXTji6tam7rk3+TszO3 NtKSV/M0iyuactxAI7oZiazWhfsFDGhBqEsnWwDejbp+T/eZlAuOnYueMYDk98hozY91 0MvLY1TdWqHJDI7mdZ0YuAMEw4w/sVjCbllYVpZS+o8KCUbjPuuU/hOWE17DYU188fte OhBHZL4pOVTNwpLV2OsSKNc3Y0TPzrSDdEVeDqgBiZ6OjZ6U8NexLx5CSWGOveoE5gCP sgGdb9X6bXlsTPGY84ZS0bbX2DaK1z9693m2UTnsl+4sNVSsvt/+VKhk9nhVl3YPkdZ1 yIPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=JBOqT8oty/C/3+/0p2Jq4SrbCruBswNGz7dfPMweCp8=; b=f6vdzkJQZOtUEKMq3JaA7zkI7zyltgcq1D69OSkqmtR18OCjFZra2EWYrUPS/pJ4W3 KFezZ/Wc/7BrDNun0l4SOcc9Un8SodUXkbO1H+90Jp7rCfo5zxUI7g4OumBOmN/CmsLP 8s2PG+40FNX7++BOMgL5HqLSstvUzymBd8wM36uJzOBVzpiGyJ4wu1sdaselXOTZtKHm 4EJAW1yG3Jk667WfDv91nV7O9oriml3ABrQ3aMkaouRx7nbEA8CYPV8++q2Qw7ijzZ5q rLqzSZtEgeTnqfKAKa3eeKWCXXarU4IoqWpsiWg6V1Ly9LQOWAFAwOpzwGQo3Bqhscl9 OLuA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of felix.moessbauer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=felix.moessbauer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id z4si125232lfr.2.2021.09.22.02.28.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Sep 2021 02:28:17 -0700 (PDT) Received-SPF: pass (google.com: domain of felix.moessbauer@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of felix.moessbauer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=felix.moessbauer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id 18M9SGOR009187 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 22 Sep 2021 11:28:16 +0200 Received: from MD1T0KAC-VM.ad001.siemens.net (md1t0kac.ad001.siemens.net [139.25.68.224]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id 18M9S3kE028537; Wed, 22 Sep 2021 11:28:16 +0200 From: Felix Moessbauer To: isar-users@googlegroups.com Cc: henning.schild@siemens.com, jan.kiszka@siemens.com, Felix Moessbauer Subject: [PATCH 4/4] split rootfs finalization and unmounting into two tasks Date: Wed, 22 Sep 2021 11:27:54 +0200 Message-Id: <20210922092754.3649703-5-felix.moessbauer@siemens.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210922092754.3649703-1-felix.moessbauer@siemens.com> References: <20210922092754.3649703-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: P9QPdF69Zk5g This patch separates the unmounting logic from do_rootfs_finalize to inject tasks in between. By that, the do_wic_image tasks can use the mount-points and finally everything is unmounted correctly. Signed-off-by: Felix Moessbauer --- meta/classes/image.bbclass | 49 +++++++++++++++++++++++++----------- meta/classes/wic-img.bbclass | 4 +-- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 1f39690..988f0d7 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -190,21 +190,6 @@ do_rootfs_finalize() { find "${ROOTFSDIR}/usr/bin" \ -maxdepth 1 -name 'qemu-*-static' -type f -delete - mountpoint -q '${ROOTFSDIR}/isar-apt' && \ - umount -l ${ROOTFSDIR}/isar-apt - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt - - mountpoint -q '${ROOTFSDIR}/base-apt' && \ - umount -l ${ROOTFSDIR}/base-apt - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt - - mountpoint -q '${ROOTFSDIR}/dev' && \ - umount -l ${ROOTFSDIR}/dev - mountpoint -q '${ROOTFSDIR}/proc' && \ - umount -l ${ROOTFSDIR}/proc - mountpoint -q '${ROOTFSDIR}/sys' && \ - umount -l ${ROOTFSDIR}/sys - rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list" @@ -219,5 +204,39 @@ EOSUDO } addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess +do_rootfs_unmount() { + sudo -s <<'EOSUDO' + ret=0 + if mountpoint -q '${ROOTFSDIR}/isar-apt'; then + umount -vl ${ROOTFSDIR}/isar-apt || ret=1 + fi + if test -d ${ROOTFSDIR}/isar-apt; then + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt || ret=1 + fi + + if mountpoint -q ${ROOTFSDIR}/base-apt; then + umount -vl ${ROOTFSDIR}/base-apt || ret=1 + fi + if test -d ${ROOTFSDIR}/base-apt; then + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt || ret=1 + fi + + if mountpoint -q ${ROOTFSDIR}/dev; then + umount -vl ${ROOTFSDIR}/dev || ret=1 + fi + if mountpoint -q ${ROOTFSDIR}/proc; then + umount -vl ${ROOTFSDIR}/proc || ret=1 + fi + if mountpoint -q '${ROOTFSDIR}/sys'; then + umount -vl ${ROOTFSDIR}/sys || ret=1 + fi + + if [$ret -ne 0]; then + bbwarn "could not unmount all mountpoints" + fi +EOSUDO +} +addtask rootfs_unmount before do_build after do_rootfs_finalize + # Last so that the image type can overwrite tasks if needed inherit ${IMAGE_TYPE} diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass index 573537c..0f5932b 100644 --- a/meta/classes/wic-img.bbclass +++ b/meta/classes/wic-img.bbclass @@ -142,12 +142,12 @@ python do_wic_image() { bb.build.exec_func("wic_do_mounts", d) try: bb.build.exec_func("generate_wic_image", d) - bb.build.exec_func("check_for_wic_warnings", d) finally: bb.build.exec_func("wic_undo_mounts", d) bb.utils.unlockfile(lock) + bb.build.exec_func("check_for_wic_warnings", d) } -addtask wic_image before do_image after do_image_tools do_rootfs_finalize +addtask wic_image before do_image do_rootfs_unmount after do_image_tools wic_do_mounts() { buildchroot_do_mounts -- 2.30.2