public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Maxim Yu. Osipov" <mosipov@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH 2/2] sdk: Check if directories are mounted before unmounting
Date: Thu, 27 Sep 2018 13:16:01 +0200	[thread overview]
Message-ID: <fad45f87-198e-6489-9b61-c17726476db0@siemens.com> (raw)
In-Reply-To: <20180927111039.16872-3-mosipov@ilbers.de>

...because it generates an error otherwise?

On 27.09.18 13:10, Maxim Yu. Osipov wrote:
> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
> ---
>  meta/classes/image.bbclass | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 1db2394..3206877 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -98,6 +98,16 @@ addtask copy_boot_files before do_build after do_rootfs
>  do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
>  do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>  
> +is_mounted() {
> +    dir_dev=`stat -c '%D' "$1"`
> +    parent_dev=`stat -c '%D' "$1/.."`
> +    if [ $dir_dev != $parent_dev ]; then
> +        return 0
> +    else
> +        return 1
> +    fi
> +}
> +
>  SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
>  
>  do_populate_sdk() {
> @@ -107,8 +117,10 @@ do_populate_sdk() {
>      # Purge apt cache to make image slimmer
>      sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
>  
> +    is_mounted ${SDKCHROOT_DIR}/rootfs/dev && sudo umount ${SDKCHROOT_DIR}/rootfs/dev
> +    is_mounted ${SDKCHROOT_DIR}/rootfs/proc && sudo umount ${SDKCHROOT_DIR}/rootfs/proc
> +
>      # Create SDK archive
> -    sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc

Wouldn't it suffice to append "|| true" then?

Jan

>      sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
>          -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
>  
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2018-09-27 11:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 11:10 [PATCH 0/2] sdk related updates Maxim Yu. Osipov
2018-09-27 11:10 ` [PATCH 1/2] sdk: Purge apt cache to make image slimmer Maxim Yu. Osipov
2018-09-27 14:11   ` Maxim Yu. Osipov
2018-09-27 11:10 ` [PATCH 2/2] sdk: Check if directories are mounted before unmounting Maxim Yu. Osipov
2018-09-27 11:16   ` Jan Kiszka [this message]
2018-09-27 11:20     ` Claudius Heine
2018-09-27 11:45     ` Maxim Yu. Osipov

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=fad45f87-198e-6489-9b61-c17726476db0@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=mosipov@ilbers.de \
    /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