From patchwork Tue Oct 1 15:13:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 3841 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Tue, 01 Oct 2024 17:14:13 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-pj1-f63.google.com (mail-pj1-f63.google.com [209.85.216.63]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 491FEBMJ014077 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 1 Oct 2024 17:14:12 +0200 Received: by mail-pj1-f63.google.com with SMTP id 98e67ed59e1d1-2e1048bd88csf3918727a91.0 for ; Tue, 01 Oct 2024 08:14:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1727795645; cv=pass; d=google.com; s=arc-20240605; b=lfv/w30sQuIQ8mW4OWNmHAi8ecI+ENsxHKLL5UgDn40aVyyR1i37SguYrQL+otKjb6 nDqUFYamgm59QV4s56zSNxTKIflAmti/NggYgLTbnI11QOUXp0/LzGA/bROgU/vut9GV ociR5OH+IuNgffQgm299sw/OvaC1OigPGiXEQt6ycqKmAr4EnycobkPsWHvqXlALxJwF nC1WcuiLjRDCqTO1ZCqgiI4e7t4IGyCuC92lQVx0HANtc+FdgFXU8CDciApQp92v7HGr yErsnpV+FwbW39OjHuI9SwQuSxPuX+JxRV3Pmb92vIG0K6Qelw0Zl0S9pAp/WxlA0+xB pktQ== 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:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HbDREeWSGj7oSvuhLhn0N6upudDIbGNyjEiVWn+4ugc=; fh=LmD0CnTPFQVBsdV3m3DIVre2NNFXGnb7cPHdK8Mw150=; b=NDpH7DFL6Rgl/KPhtD8fWqBAq1QAEzveRUKkwZ53MviJcgink3CffY+vpFguC64Ji8 7X/9w5K/g5UyMilNmK6oGbOTf2FftyzClGMwClg6+zAtX3aoYE0PGpYBfZXVUHMuS+q/ ByKudkc6cL3IqBzKzvXDEVtqQH40TqOytnI4cS5LCdJp7f/HrZePpOPMOnyOkM+ErSFu 5QlvIsP5ZJASa4ya/06GKroB3r2D3d7OiNpaXkXNBqJUY+a15OTDmKvY/ggbDh21Rrit 0gQgblsNVPA7dz8Zryj06+gYvzPKLH8lxIiPPGhUA416IaXgriCb7ygzRdKnef3WpeTo YM2Q==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Y6LnXluv; spf=pass (google.com: domain of fm-294854-20241001151400eebc8bdafdad8ec274-6sxvlf@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) smtp.mailfrom=fm-294854-20241001151400eebc8bdafdad8ec274-6sXVLf@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1727795645; x=1728400445; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=HbDREeWSGj7oSvuhLhn0N6upudDIbGNyjEiVWn+4ugc=; b=BfkTs396N65hLe3Me2IYy1PdmsRTnX4V3x1m3AT3uH5wSHpC0QmsJiSGsYwOlRmKur h3sVm4eRXWVlO812oDP+94/mbKTjZxeN65mV2MeLEkmxwU+lM2abr3HCy24AUAYAVcfE RgJ/A3WXuGr8XKGkEUqi+NZGUWBYY//gwQDgMDdrGxuoO0riHXIClBNgt47H4wPAj2dM LQvuUBHCacO3Z8y8p7TnwPXTGtyTH1+9urQG7jpi4ViQZ+VgtR9j041+oQs0f7IIqcbN uAErPVmo/3m7yAFqvqCa6075seZs+QYrnmcgpGKszeokr0kNLx1YkcVB3XWPCel3awrA avTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727795645; x=1728400445; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HbDREeWSGj7oSvuhLhn0N6upudDIbGNyjEiVWn+4ugc=; b=u34I5cnbZZgZzAcL+gtd/rnHM/HFZ0VigxLy65G1TKAil6VZPo6zLSsQHkQ1LehUzV fY8Hl5MRtxvIbH4cSXeZhN3VOpfNWeR11Jx9uzaAatA5Wwzm7xG9bPykdlJC0nS8cgGa byOz68ab5r7ZApoo9KYiOLPQdqUp1HC5zVPzOa+gNWEwAfMSFmi8+x6QVU0+kdzwnlJq C4jHJnvQskS6JnbdbZ6PpkGxTIOkqPCWSYYHr85VsDsas5iFN7z4nMb991kts5aKc/UX nGYIFJlLBqtoqHWCN8X8cVaJHdag+Ze8js0bLDnjmhh2DZEmS4bu1MqvCQx3PLwmdmjZ EQSQ== X-Forwarded-Encrypted: i=2; AJvYcCUiECP9Xbe3WaXsdAWIxG9XdqbXUfvum1bJg2F3JeEgvmEUap9AV6nEWKIuRBRVqaSbR4Rjhgk=@isar-build.org X-Gm-Message-State: AOJu0YwfNSy+FU6pLZdfir6jkTe1383DzuFpbRQ5o52yaZuNOLUyeGwp up50KpYQDwQVKf48HwwSS0aAcujiBq6WQ0VN3NLgkGprKYxsZZoy X-Google-Smtp-Source: AGHT+IEBm7Q6/Hoy3LzRE/hRgx6l6EYAMXkOW33OdyhDdX4LfrnoIEapxOhivYXO+HvfVemiENwEKA== X-Received: by 2002:a17:90b:1c87:b0:2d8:8d34:5b8 with SMTP id 98e67ed59e1d1-2e18469315amr40665a91.10.1727795644847; Tue, 01 Oct 2024 08:14:04 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:90a:de94:b0:2cb:4a85:9588 with SMTP id 98e67ed59e1d1-2e0909d1cc3ls3435327a91.1.-pod-prod-03-us; Tue, 01 Oct 2024 08:14:03 -0700 (PDT) X-Received: by 2002:a17:90a:d814:b0:2da:8e9b:f37b with SMTP id 98e67ed59e1d1-2e184814f7bmr30165a91.24.1727795642746; Tue, 01 Oct 2024 08:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727795642; cv=none; d=google.com; s=arc-20240605; b=lfRCNeLdr9Fls4dQV0chRkfdZ6LyLY1lzDGhOHlBa5zfHPHDQOYOKGPVFmH+xFL5+9 aiYjx+lzHF/7MmyM9Z9ISQwd2qZBF5WceWiAyTwQConRl8uAqLyaL+zUYXRJaYVocFMm YsOicmUTxpMkx0FAmfJ1nygbAATM/kpfl7FxYMJwtw1A7CbAyKT7rPikzpuA12nga9MA 5QEkDLJq009CeEG7FXz87LPF0Y1tlURKY3CTCZ86B1zMF9LzmXQIzBqVL7BUONeDFfhN KlKnTgT7+79M/4bs4cbLwBDhDznMqeFAbXf3qB9MCt6UhTy/sfbjwrRkDtqGBmpK9WXt 6zgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=KRXGOByZsAUou3GMTqBRF3bIWkykNaMS+P+QePQa3CA=; fh=gjNsleUMU++pCCGGHOTELE3rzItC14u9gn4+F3xKmnc=; b=jiqyGUZs/Gkgtdes19STE6HLcy09+AyYmu6xQqj7u5lj1nTfIaW6pjKI9F/Tlei3R1 FN6fs8SArykavDcXbpsFN5EJU1fpk87kXLy2s5+/Bcmfl6O3ks//+5YaHT8qpWw3JLbu V3YYyCaa6kfwsNo003xRwzLy49IBQSZSiKtnPof4kYHjxJmv+8KSRwueLUB7TFs2ugeD OhQr0R+EaQO2a2XOZNOtbvkjJFD1egPGn3zjXk5DuRzSJSGNq+z6vWd8W0myqii5booD Ayuc+76IjCmWU3KRfKT6/GwAX7MWGk9oGfgjvotIa8awKac7ocS6KZs7c9QF/ehPukVJ VaUw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Y6LnXluv; spf=pass (google.com: domain of fm-294854-20241001151400eebc8bdafdad8ec274-6sxvlf@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) smtp.mailfrom=fm-294854-20241001151400eebc8bdafdad8ec274-6sXVLf@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net. [185.136.64.227]) by gmr-mx.google.com with ESMTPS id 98e67ed59e1d1-2e1829cc7a3si4821a91.1.2024.10.01.08.14.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2024 08:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-294854-20241001151400eebc8bdafdad8ec274-6sxvlf@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) client-ip=185.136.64.227; Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20241001151400eebc8bdafdad8ec274 for ; Tue, 01 Oct 2024 17:14:00 +0200 X-Patchwork-Original-From: "'Jan Kiszka' via isar-users" From: Jan Kiszka To: isar-users Cc: Florian Bezdeka Subject: [PATCH v2 2/3] rootfs: Provide rootfs_do_umounts Date: Tue, 1 Oct 2024 17:13:58 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer X-Original-Sender: jan.kiszka@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Y6LnXluv; spf=pass (google.com: domain of fm-294854-20241001151400eebc8bdafdad8ec274-6sxvlf@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) smtp.mailfrom=fm-294854-20241001151400eebc8bdafdad8ec274-6sXVLf@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Jan Kiszka Reply-To: Jan Kiszka 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-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,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-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 ef25df49..1414a3ee 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -393,6 +393,8 @@ python do_deploy() { addtask deploy before do_build after do_image do_rootfs_finalize() { + rootfs_do_umounts + sudo -s <<'EOSUDO' set -e @@ -406,32 +408,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