public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'cedric.hombourger@siemens.com' via isar-users" <isar-users@googlegroups.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"Kumar, Rakesh" <kumar.rakesh@siemens.com>
Cc: "Kiszka, Jan" <jan.kiszka@siemens.com>
Subject: Re: [PATCH 2/2] initramfs-fsck-hook: improve error handling and correct fsck path
Date: Mon, 9 Sep 2024 03:13:37 +0000	[thread overview]
Message-ID: <126938f80862ca2a11be38e496d3efd17a6b3fe4.camel@siemens.com> (raw)
In-Reply-To: <20240907165104.1825446-2-kumar.rakesh@siemens.com>

On Sat, 2024-09-07 at 22:21 +0530, Rakesh Kumar wrote:
> * Used hook_error() function to improve error handling during
>   copy_exec calls in the initramfs hook script.

Rather than paraphrasing each copy_exec call, I would mimic what Debian
hooks such as /usr/share/initramfs-tools/hooks/{fuse,plymouth} do: have
the hook use "set -e" towards the beginning of the script to simply
abort as soon as a command fail.

	set -e
	copy_exec ...
	copy_exec ...


> * Corrected the path for fsck from /sbin/fsck to /usr/sbin/fsck.

I am sorry but /sbin/fsck is correct

	# dpkg -S /usr/sbin/fsck
	dpkg-query: no path found matching pattern /usr/sbin/fsck
	# dpkg -S /sbin/fsck
	util-linux: /sbin/fsck

> 
> Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
> ---
>  .../files/initramfs-fsck-ext4.hook            | 21 +++++++----------
> --
>  1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/meta/recipes-support/initramfs-fsck-
> hook/files/initramfs-fsck-ext4.hook b/meta/recipes-support/initramfs-
> fsck-hook/files/initramfs-fsck-ext4.hook
> index 259b73b4..4762c805 100644
> --- a/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-
> ext4.hook
> +++ b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-
> ext4.hook
> @@ -5,8 +5,6 @@
>  
>  #!/bin/sh
>  
> -set -e
> -
>  PREREQ=""
>  
>  prereqs()
> @@ -24,16 +22,11 @@ esac
>  . /usr/share/initramfs-tools/scripts/functions
>  . /usr/share/initramfs-tools/hook-functions
>  
> -if [ ! -x /sbin/fsck ]; then
> -       echo "Warning: couldn't find /sbin/fsck!"
> -       exit 0
> -fi
> -
> -copy_exec /sbin/fsck
> -copy_exec /sbin/logsave
> +hook_error() {
> +    echo "(ERROR): $1" >&2
> +    exit 1
> +}
>  
> -if prog="$(command -v fsck.ext4)"; then
> -  copy_exec "$prog"
> -else
> -  echo "Warning: /sbin/fsck.ext4 doesn't exist, can't install to
> initramfs, ignoring."
> -fi
> +copy_exec /sbin/fsck || hook_error "Unable to copy /usr/sbin/fsck"
> +copy_exec /sbin/logsave || hook_error "Unable to copy
> /usr/sbin/logsave"
> +copy_exec /usr/sbin/fsck.ext4 || hook_error "Unable to copy
> /usr/sbin/fsck.ext4"


-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/126938f80862ca2a11be38e496d3efd17a6b3fe4.camel%40siemens.com.

  reply	other threads:[~2024-09-09  3:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  9:39 [PATCH] initramfs-fsck-hook: bump version and improve error handling 'Rakesh Kumar' via isar-users
2024-09-06  9:56 ` 'Jan Kiszka' via isar-users
2024-09-07 16:51   ` [PATCH 1/2] initramfs-fsck-hook: bump version, rename package and files 'Rakesh Kumar' via isar-users
2024-09-07 16:51     ` [PATCH 2/2] initramfs-fsck-hook: improve error handling and correct fsck path 'Rakesh Kumar' via isar-users
2024-09-09  3:13       ` 'cedric.hombourger@siemens.com' via isar-users [this message]
2024-09-09  3:15     ` [PATCH 1/2] initramfs-fsck-hook: bump version, rename package and files 'cedric.hombourger@siemens.com' via isar-users
2024-09-07 16:59   ` [PATCH 0/2] initramfs-fsck-hook: version bump to 0.3 and error handling improvement 'Rakesh Kumar' via isar-users

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=126938f80862ca2a11be38e496d3efd17a6b3fe4.camel@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kumar.rakesh@siemens.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