From patchwork Fri Oct 11 10:00:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Mikanovich X-Patchwork-Id: 3865 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Fri, 11 Oct 2024 12:01:14 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-ot1-f62.google.com (mail-ot1-f62.google.com [209.85.210.62]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 49BA1CdK008733 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 11 Oct 2024 12:01:13 +0200 Received: by mail-ot1-f62.google.com with SMTP id 46e09a7af769-70937ade3desf1092281a34.2 for ; Fri, 11 Oct 2024 03:01:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728640866; cv=pass; d=google.com; s=arc-20240605; b=XG4GpSS06uO4y6xslZ+zLOZ+7ONznLcgdM46bMg6bDvau6KLS6L7X05Hy6coH90oUp 8ChiZ5N+GBGnohDb55kkBFS6nDohVhVRCGeEkK9A9jsscpoE2HJ5oI5plt5yQrPYlZnw IPC9KC8jTjC1qSFt8aoEw/m+25TBmKMDBnAH2AD242DfpfLHpmuh80cTEoQ7teEstGeV lBkgPJVs5nB+61UgaCIk4K8UKcYFSnEK1BqzeyBIMwIeUyAr94MqHVeCSrNt1XB08qtb fejBm7+xWu0xJg1MLcgShDu1iIBGdiXunh/lY501nhmizu833UAY82uSgXAD98bEu++I 3h6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=7grNpAoxAN2YLhzE1f0rdnLvLJ8te4vvQL6gV5/wIPk=; fh=aW58qMcHt2bjb29nZ6qjeq8tmD7EXFCJzioIpVDbv2o=; b=EIQqCVVFW7lIjhp9VPQOEQHHGY2h3CuMxe+m4J+fxgXsvSccawqDu78PsV2jwfaX/B kKQzjBkMc1fFrbWqhFl0PWmfeHnf0BsBNAMdyP+cJp9XdVW9SYJwKf5S/2s0lf2ryNp1 L3lLfhn7I/MopkktWXZEFbZDnSKmggEZzUIjxVENKs+oFZ958Azy+qPZR1fLvzl0iT8C cxuM5xHtlTh/PlMTMpFy1/Fq+LRdU9E3SV36zAIvifmnwrWWDTfyHtgn5+iWFiQ3Ax+e VMVOjsr3LDMyoGFdNBAf4/Fh1wL2UiHe9JwuMlFWi8gDimuRlm0hMRXfSwEsv2HZhDBK 8zHQ==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1728640866; x=1729245666; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=7grNpAoxAN2YLhzE1f0rdnLvLJ8te4vvQL6gV5/wIPk=; b=A8Bv6VcmqBg/ywNdYsQWmI8HZAGChuzKrjMdiRidsXE93KaqbnN8hm0qP77rBmf5lV tPC4oniGlvLz/s2gB9OnUUgKmuNpxSrqrmkpTAgi7E8rNgjrv1LIhGOPEO9q0Dt3FpGD eWDwKgfis9/kCK4nZr+NwVaUS/SwqOTNzKQFQyJbG8jkXXfNUWk60BcWX35ATyfo3kwR Y3FWzjIS1vFIjCagyY5fwI9wCvGFVjIopNoNOwNNIcM6PgKUuLK1tv8krohgfeqanN5V SWTieZEKb0vFII9wFQSEMkVA495vCf/WNH8F9DR3AF/FO277CKG/8PpAh7HzPgfqTH89 g/RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728640866; x=1729245666; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=7grNpAoxAN2YLhzE1f0rdnLvLJ8te4vvQL6gV5/wIPk=; b=PJigKWLOXPhywe2A0IS/9qLtrdP9yqx5UjNTT2jCtx3KgLiZ7TIElBFQuFfLHXi33/ F9QLEMluof2omsP4dX0ZBXpDT7+aggZAao+pWH1Nl0VldtBWmlcXD+LJ8xQg7y78wYQx v1mWA/PjPlCWyjEz+ikXlmiuMVu1CQbgWnmj7GpdpvYI97gBFNTGIPYjjZsDdGgU0lJl zhL4/nhOlNf5mcC2+7UisIp0rlFVXApFK4FJulWba7uQ6dZXtBIC7wKLiL3p7Ia7sEvv gnICJ/tYhxAPxmvLei3t+rFXPZ6iKVazj8r//d7wLbiuDX3MVl6ihEgYzuKXffZ+dV0c ftSg== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWCPhnQLXtIlC98RstcAnynzlWynjiLN/q7SU5zvusdQgW5qDjymSWB325oukGvn8JqxNeb8Fs=@isar-build.org X-Gm-Message-State: AOJu0YwnK+MofnXuAHv/kdcS4+tcq4EjMPotKMKbKM+usOedYdp/r8Sr DGeMFs0CfuPorPNNla4bcuNnAFHcfWCyQlZ93COabvBCXRxOcLOi X-Google-Smtp-Source: AGHT+IGNaFkOpx95TlV0vCmkO9DXYWiNK1yr4rv98bladNdikQx71vaKcORxljlGgDV3/MwxSE7z+A== X-Received: by 2002:a05:6830:258c:b0:717:d48c:593 with SMTP id 46e09a7af769-717d6445b16mr1168536a34.10.1728640866416; Fri, 11 Oct 2024 03:01:06 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a4a:e38c:0:b0:5e7:af90:76b5 with SMTP id 006d021491bc7-5e990b1ffa1ls732249eaf.0.-pod-prod-07-us; Fri, 11 Oct 2024 03:01:05 -0700 (PDT) X-Received: by 2002:a05:6830:915:b0:717:d601:eb43 with SMTP id 46e09a7af769-717d64fe404mr1033474a34.26.1728640865274; Fri, 11 Oct 2024 03:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728640865; cv=none; d=google.com; s=arc-20240605; b=FH8Gv549tL2wgOjgo2SKcy4QDCexJpU3ibl8KMUP6ZugIZdA8XAXgI3qeXhYUHOWyG z9iZjIH+8hs1FD31UniR0rMuhrfPewdtmvYG6wwEvgr9Q25rhKfa67G8QnGMcoJ952oY iovj4JPZt9IgNK+4wSfx4xmNw5sY6EjO7IwBq6N5FwYFx6Q0RijyEqfHP/hWCJwuPVRJ 2/3Y4CkRXVel6eKkFc7IQXk1+2gHTJ7D3M32qZXKVZ70Rm77EmcITknPBDvf1i85HMdp fGtg7OQP21eFJo0WIzxUTjMx1jskb3p/RLXMihBiuzAQOZO+WRJWg+XyqxbhZ7EHVa+c 54IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=+j9WCd7MUU3bwwJzOPz6IhzlPzKTOE5scvISNzGkx9g=; fh=ayfAe8qmvuhnFlecYJaCAyE02arlonJgV2H/zKorYgo=; b=Q4W1T5QYWDkPqeW1Dh4fVG3PHeRTBss84xVDbEiyghPAxmEwUFeVqP6HKb7pB5XMUG mChq7aCQLoQQaWfHwoUunyDjqXlorSp94iScEQ63FYEs5GvC7XVYn+FgFsWB2KLot4vR Ev0ItjgwtZNY7icGSdEeFHqV0nM+lPvkMtnoMNbYAlFSvfMUjubNi53QOWHUuC1UQqtx ZwdnI04MIm6jJSx69UMDsIjtpt84WvdDmJU9ITS1ivNOyqa6ugGB9Z0pdv6W91sl6HDo mgBJypVBSzOwJ5vg1oCZBrpECAsSpyZIx3hiKFsvjeJwLN5l1CsEVzzn/fUTm1VtuGn/ yTfQ==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id 46e09a7af769-717cfed0e73si132856a34.1.2024.10.11.03.01.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Oct 2024 03:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Received: from user-B660.promwad.corp ([159.148.83.114]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 49BA0vWM008632 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 12:01:02 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Jan Kiszka Subject: [PATCH v3 5/8] rootfs: Provide rootfs_do_umounts Date: Fri, 11 Oct 2024 13:00:47 +0300 Message-Id: <20241011100050.322686-6-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241011100050.322686-1-amikan@ilbers.de> References: <20241011100050.322686-1-amikan@ilbers.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-Original-Sender: amikan@ilbers.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Jan Kiszka This will be used more frequently soon to avoid dangling mounts. Signed-off-by: Jan Kiszka --- meta/classes/image.bbclass | 28 ++-------------------------- meta/classes/rootfs.bbclass | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 9d5b782a..1eb974e8 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -405,6 +405,8 @@ def apt_list_files(d): IMAGE_LISTS = "${@ ' '.join(apt_list_files(d)) }" do_rootfs_finalize() { + rootfs_do_umounts + sudo -s <<'EOSUDO' set -e @@ -418,32 +420,6 @@ do_rootfs_finalize() { -maxdepth 1 -name 'qemu-*-static' -type f -delete fi - if mountpoint -q '${ROOTFSDIR}/isar-apt'; then - umount '${ROOTFSDIR}/isar-apt' - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt - fi - - if mountpoint -q '${ROOTFSDIR}/base-apt'; then - umount '${ROOTFSDIR}/base-apt' - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt - fi - - if mountpoint -q '${ROOTFSDIR}/dev/pts'; then - umount '${ROOTFSDIR}/dev/pts' - fi - if mountpoint -q '${ROOTFSDIR}/dev/shm'; then - umount '${ROOTFSDIR}/dev/shm' - fi - if mountpoint -q '${ROOTFSDIR}/dev'; then - umount '${ROOTFSDIR}/dev' - fi - if mountpoint -q '${ROOTFSDIR}/proc'; then - umount '${ROOTFSDIR}/proc' - fi - if mountpoint -q '${ROOTFSDIR}/sys'; then - umount '${ROOTFSDIR}/sys' - fi - if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then mv "${ROOTFSDIR}/etc/apt/sources-list" \ "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass index f0abd795..ef40cbdf 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -65,6 +65,38 @@ rootfs_do_mounts() { EOSUDO } +rootfs_do_umounts() { + sudo -s <<'EOSUDO' + set -e + if mountpoint -q '${ROOTFSDIR}/isar-apt'; then + umount '${ROOTFSDIR}/isar-apt' + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt + fi + + if mountpoint -q '${ROOTFSDIR}/base-apt'; then + umount '${ROOTFSDIR}/base-apt' + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt + fi + + if mountpoint -q '${ROOTFSDIR}/dev/pts'; then + umount '${ROOTFSDIR}/dev/pts' + fi + if mountpoint -q '${ROOTFSDIR}/dev/shm'; then + umount '${ROOTFSDIR}/dev/shm' + fi + if mountpoint -q '${ROOTFSDIR}/dev'; then + umount '${ROOTFSDIR}/dev' + fi + if mountpoint -q '${ROOTFSDIR}/proc'; then + umount '${ROOTFSDIR}/proc' + fi + if mountpoint -q '${ROOTFSDIR}/sys'; then + umount '${ROOTFSDIR}/sys' + fi + +EOSUDO +} + rootfs_do_qemu() { if [ '${@repr(d.getVar('ROOTFS_ARCH') == d.getVar('HOST_ARCH'))}' = 'False' ] then