public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anton Mikanovich <amikan@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH v1 2/5] mount: Allow calling unmount on not mounted paths
Date: Thu, 8 Jul 2021 14:17:13 +0200	[thread overview]
Message-ID: <62670c5b-00d6-efd0-7f85-073dd65ae34a@siemens.com> (raw)
In-Reply-To: <20210707163851.204296-3-amikan@ilbers.de>

On 07.07.21 18:38, Anton Mikanovich wrote:
> Make buildchroot_undo_mounts and rootfs_undo_mounts functions do not
> fail if calling without buildchroot_do_mounts and rootfs_do_mounts.
> 

"Why" is missing, you only have the "what" here.

Jan

> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> ---
>  meta/classes/buildchroot.bbclass | 20 ++++++++++----------
>  meta/classes/rootfs.bbclass      | 20 ++++++++++----------
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
> index 806a29f..9c27711 100644
> --- a/meta/classes/buildchroot.bbclass
> +++ b/meta/classes/buildchroot.bbclass
> @@ -23,16 +23,18 @@ python __anonymous() {
>  
>  MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}.lock"
>  
> +BUILDCHROOT_MOUNT_CNT = "${BUILDCHROOT_DIR}.mount"
> +
>  buildchroot_do_mounts() {
>      sudo -s <<'EOSUDO'
>          ( flock 9
>          set -e
>  
>          count="1"
> -        if [ -f '${BUILDCHROOT_DIR}.mount' ]; then
> -            count=$(($(cat '${BUILDCHROOT_DIR}.mount') + 1))
> +        if [ -f "${BUILDCHROOT_MOUNT_CNT}" ]; then
> +            count=$(($(cat "${BUILDCHROOT_MOUNT_CNT}") + 1))
>          fi
> -        echo $count > '${BUILDCHROOT_DIR}.mount'
> +        echo $count > "${BUILDCHROOT_MOUNT_CNT}"
>          if [ $count -gt 1 ]; then
>              exit 0
>          fi
> @@ -77,17 +79,15 @@ buildchroot_undo_mounts() {
>          ( flock 9
>          set -e
>  
> -        if [ -f '${BUILDCHROOT_DIR}.mount' ]; then
> -            count=$(($(cat '${BUILDCHROOT_DIR}.mount') - 1))
> -            echo $count > '${BUILDCHROOT_DIR}.mount'
> -        else
> -            echo "Could not find mount counter"
> -            exit 1
> +        count="0"
> +        if [ -f "${BUILDCHROOT_MOUNT_CNT}" ]; then
> +            count=$(($(cat "${BUILDCHROOT_MOUNT_CNT}") - 1))
> +            echo $count > "${BUILDCHROOT_MOUNT_CNT}"
>          fi
>          if [ $count -gt 0 ]; then
>              exit 0
>          fi
> -        rm ${BUILDCHROOT_DIR}.mount
> +        rm -f "${BUILDCHROOT_MOUNT_CNT}"
>  
>          mountpoint -q '${BUILDCHROOT_DIR}/base-apt' && \
>              umount ${BUILDCHROOT_DIR}/base-apt && \
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index 50d6408..9ccc8e3 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -28,6 +28,8 @@ export LC_ALL = "C"
>  
>  MOUNT_LOCKFILE = "${ROOTFSDIR}.lock"
>  
> +ROOTFS_MOUNT_CNT = "${ROOTFSDIR}.mount"
> +
>  rootfs_do_mounts[weight] = "3"
>  rootfs_do_mounts() {
>      sudo -s <<'EOSUDO'
> @@ -35,10 +37,10 @@ rootfs_do_mounts() {
>          set -e
>  
>          count="1"
> -        if [ -f '${ROOTFSDIR}.mount' ]; then
> -            count=$(($(cat '${ROOTFSDIR}.mount') + 1))
> +        if [ -f "${ROOTFS_MOUNT_CNT}" ]; then
> +            count=$(($(cat "${ROOTFS_MOUNT_CNT}") + 1))
>          fi
> -        echo $count > '${ROOTFSDIR}.mount'
> +        echo $count > "${ROOTFS_MOUNT_CNT}"
>          if [ $count -gt 1 ]; then
>              exit 0
>          fi
> @@ -79,17 +81,15 @@ rootfs_undo_mounts() {
>          ( flock 9
>          set -e
>  
> -        if [ -f '${ROOTFSDIR}.mount' ]; then
> -            count=$(($(cat '${ROOTFSDIR}.mount') - 1))
> -            echo $count > '${ROOTFSDIR}.mount'
> -        else
> -            echo "Could not find mount counter"
> -            exit 1
> +        count="0"
> +        if [ -f "${ROOTFS_MOUNT_CNT}" ]; then
> +            count=$(($(cat "${ROOTFS_MOUNT_CNT}") - 1))
> +            echo $count > "${ROOTFS_MOUNT_CNT}"
>          fi
>          if [ $count -gt 0 ]; then
>              exit 0
>          fi
> -        rm ${ROOTFSDIR}.mount
> +        rm -f "${ROOTFS_MOUNT_CNT}"
>  
>          mountpoint -q '${ROOTFSDIR}/base-apt' && \
>              umount ${ROOTFSDIR}/base-apt && \
> 

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

  reply	other threads:[~2021-07-08 12:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 16:38 [PATCH v1 0/5] Restore downstream mounts compatibility Anton Mikanovich
2021-07-07 16:38 ` [PATCH v1 1/5] Revert "dpkg: Make mount buildroot reliable" Anton Mikanovich
2021-07-08 12:16   ` Jan Kiszka
2021-07-07 16:38 ` [PATCH v1 2/5] mount: Allow calling unmount on not mounted paths Anton Mikanovich
2021-07-08 12:17   ` Jan Kiszka [this message]
2021-07-07 16:38 ` [PATCH v1 3/5] dpkg: Remove unmount loop Anton Mikanovich
2021-07-08 12:21   ` Jan Kiszka
2021-07-08 14:35     ` Anton Mikanovich
2021-07-08 16:16       ` Jan Kiszka
2021-08-17 13:02     ` Anton Mikanovich
2021-07-07 16:38 ` [PATCH v1 4/5] image: Add reference counter Anton Mikanovich
2021-07-07 16:38 ` [PATCH v1 5/5] events: Unmount all lost mounts at task fail Anton Mikanovich
2021-07-08 12:24   ` Jan Kiszka
2021-07-08 14:41     ` Anton Mikanovich
2021-07-08 16:28       ` Jan Kiszka
2021-07-12 16:08         ` Baurzhan Ismagulov

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=62670c5b-00d6-efd0-7f85-073dd65ae34a@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=amikan@ilbers.de \
    --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