cip-dev.lists.cip-project.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Quirin Gylstorff <Quirin.Gylstorff@siemens.com>,
	cip-dev@lists.cip-project.org
Subject: Re: [cip-dev][isar-cip-core][PATCH] initramfs-abrootfs: check if /etc/os-release exists
Date: Thu, 8 Dec 2022 10:30:16 +0100	[thread overview]
Message-ID: <cfc8b418-0f95-a21a-0aaa-8c7d2a9da37a@siemens.com> (raw)
In-Reply-To: <20221130111827.43184-1-Quirin.Gylstorff@siemens.com>

On 30.11.22 12:18, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> If a valid root file system does not contain /etc/os-release the
> script aborts before checking other root file systems. This occurs
> for example if the boot occurs from a USB stick and a ext4 root
> file system exists on internal memory.
> 
> Also ensure that IMAGE_UUID and TARGET_IMAGE_UUID are not empty
> before comparing to each other.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  .../initramfs-abrootfs-hook/files/abrootfs.script          | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/recipes-initramfs/initramfs-abrootfs-hook/files/abrootfs.script b/recipes-initramfs/initramfs-abrootfs-hook/files/abrootfs.script
> index 23bbfe7..848e829 100644
> --- a/recipes-initramfs/initramfs-abrootfs-hook/files/abrootfs.script
> +++ b/recipes-initramfs/initramfs-abrootfs-hook/files/abrootfs.script
> @@ -35,9 +35,12 @@ find_root_via_image_uuid()
>      for part in $partitions; do
>          if [ "$(blkid -p "${part}" --match-types novfat -s USAGE -o value)" = "filesystem" ]; then
>              mount -o ro -t "$(get_fstype "${part}")" "${part}" "${rootmnt}"
> -            . "${rootmnt}/etc/os-release"
> +            if [ -e "${rootmnt}/etc/os-release" ]; then
> +                . "${rootmnt}/etc/os-release"
> +            fi
>              umount "${rootmnt}"
> -            if [ "${IMAGE_UUID}" = "${TARGET_IMAGE_UUID}" ]; then
> +            if [ -n "${IMAGE_UUID}" ] && [ -n "${TARGET_IMAGE_UUID}" ] &&
> +                   [ "${IMAGE_UUID}" = "${TARGET_IMAGE_UUID}" ]; then
>                  found_root="${part}"
>                  break
>              fi

Thanks, applied.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux



      reply	other threads:[~2022-12-08  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 11:18 [cip-dev][isar-cip-core][PATCH] initramfs-abrootfs: check if /etc/os-release exists Quirin Gylstorff
2022-12-08  9:30 ` Jan Kiszka [this message]

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=cfc8b418-0f95-a21a-0aaa-8c7d2a9da37a@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Quirin.Gylstorff@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    /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;
as well as URLs for NNTP newsgroup(s).