* [PATCH] initramfs-fsck-hook: bump version and improve error handling
@ 2024-09-06 9:39 'Rakesh Kumar' via isar-users
2024-09-06 9:56 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 7+ messages in thread
From: 'Rakesh Kumar' via isar-users @ 2024-09-06 9:39 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, cedric.hombourger, Rakesh Kumar
* Bump initramfs-fsck-hook version from 0.2 to 0.3.
* Renamed the package from initramfs-fsck-hook-ext4 to initramfs-fsck-ext4
for better readability.
* Improved error handling in the hook script by introducing the
hook_error() function to handle failures during copy_exec calls.
* Corrected the path for fsck from /sbin/fsck to /usr/sbin/fsck to
reflect the correct location of the binary.
The script now provides clear error messages and exits on failure,
preventing silent errors during the initramfs setup.
Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
---
...sck.ext4.hook => initramfs-fsck-ext4.hook} | 21 +++++++------------
....triggers => initramfs-fsck-ext4.triggers} | 0
.../initramfs-fsck-ext4_0.3.bb | 19 +++++++++++++++++
.../initramfs-fsck-hook-ext4_0.2.bb | 18 ----------------
4 files changed, 26 insertions(+), 32 deletions(-)
rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs.fsck.ext4.hook => initramfs-fsck-ext4.hook} (51%)
rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs-fsck-hook-ext4.triggers => initramfs-fsck-ext4.triggers} (100%)
create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
delete mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
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
similarity index 51%
rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.hook
index 259b73b4..e81f06f9 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 /usr/sbin/fsck || hook_error "Unable to copy /usr/sbin/fsck"
+copy_exec /usr/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"
diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
similarity index 100%
rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
new file mode 100644
index 00000000..c2136f9d
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
@@ -0,0 +1,19 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+
+DESCRIPTION = "Recipe to add fsck hook to the initramfs"
+
+DEBIAN_DEPENDS = "e2fsprogs,initramfs-tools"
+
+inherit dpkg-raw
+SRC_URI = "file://${PN}.triggers \
+ file://${PN}.hook \
+ "
+do_install[cleandirs] += "${D}/etc/initramfs-tools/hooks"
+
+do_install() {
+ install -m 0755 ${WORKDIR}/${PN}.hook ${D}/etc/initramfs-tools/hooks/
+}
diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
deleted file mode 100644
index 9860dbc8..00000000
--- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-
-DESCRIPTION = "Recipe to add fsck hook to the initramfs"
-
-inherit dpkg-raw
-SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
- file://initramfs.fsck.ext4.hook \
- "
-
-
-do_install() {
- install -m 0755 -d ${D}/etc/initramfs-tools/hooks
- install -m 0740 ${WORKDIR}/initramfs.fsck.ext4.hook ${D}/etc/initramfs-tools/hooks/fsck.ext4.hook
-}
--
2.39.2
--
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/20240906093927.1814962-1-kumar.rakesh%40siemens.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] initramfs-fsck-hook: bump version and improve error handling
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:59 ` [PATCH 0/2] initramfs-fsck-hook: version bump to 0.3 and error handling improvement 'Rakesh Kumar' via isar-users
0 siblings, 2 replies; 7+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2024-09-06 9:56 UTC (permalink / raw)
To: Rakesh Kumar, isar-users; +Cc: cedric.hombourger
On 06.09.24 11:39, Rakesh Kumar wrote:
> * Bump initramfs-fsck-hook version from 0.2 to 0.3.
> * Renamed the package from initramfs-fsck-hook-ext4 to initramfs-fsck-ext4
> for better readability.
> * Improved error handling in the hook script by introducing the
> hook_error() function to handle failures during copy_exec calls.
> * Corrected the path for fsck from /sbin/fsck to /usr/sbin/fsck to
> reflect the correct location of the binary.
4 topics, 4 patches. Well, maybe 3. But not just 1.
Jan
>
> The script now provides clear error messages and exits on failure,
> preventing silent errors during the initramfs setup.
>
> Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
> ---
> ...sck.ext4.hook => initramfs-fsck-ext4.hook} | 21 +++++++------------
> ....triggers => initramfs-fsck-ext4.triggers} | 0
> .../initramfs-fsck-ext4_0.3.bb | 19 +++++++++++++++++
> .../initramfs-fsck-hook-ext4_0.2.bb | 18 ----------------
> 4 files changed, 26 insertions(+), 32 deletions(-)
> rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs.fsck.ext4.hook => initramfs-fsck-ext4.hook} (51%)
> rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs-fsck-hook-ext4.triggers => initramfs-fsck-ext4.triggers} (100%)
> create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
> delete mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
>
> 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
> similarity index 51%
> rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
> rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.hook
> index 259b73b4..e81f06f9 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 /usr/sbin/fsck || hook_error "Unable to copy /usr/sbin/fsck"
> +copy_exec /usr/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"
> diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
> similarity index 100%
> rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
> rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
> diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
> new file mode 100644
> index 00000000..c2136f9d
> --- /dev/null
> +++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
> @@ -0,0 +1,19 @@
> +# This software is a part of ISAR.
> +# Copyright (C) Siemens AG, 2019
> +#
> +# SPDX-License-Identifier: MIT
> +
> +
> +DESCRIPTION = "Recipe to add fsck hook to the initramfs"
> +
> +DEBIAN_DEPENDS = "e2fsprogs,initramfs-tools"
> +
> +inherit dpkg-raw
> +SRC_URI = "file://${PN}.triggers \
> + file://${PN}.hook \
> + "
> +do_install[cleandirs] += "${D}/etc/initramfs-tools/hooks"
> +
> +do_install() {
> + install -m 0755 ${WORKDIR}/${PN}.hook ${D}/etc/initramfs-tools/hooks/
> +}
> diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
> deleted file mode 100644
> index 9860dbc8..00000000
> --- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -# This software is a part of ISAR.
> -# Copyright (C) Siemens AG, 2019
> -#
> -# SPDX-License-Identifier: MIT
> -
> -
> -DESCRIPTION = "Recipe to add fsck hook to the initramfs"
> -
> -inherit dpkg-raw
> -SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
> - file://initramfs.fsck.ext4.hook \
> - "
> -
> -
> -do_install() {
> - install -m 0755 -d ${D}/etc/initramfs-tools/hooks
> - install -m 0740 ${WORKDIR}/initramfs.fsck.ext4.hook ${D}/etc/initramfs-tools/hooks/fsck.ext4.hook
> -}
--
Siemens AG, Technology
Linux Expert Center
--
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/d0b4a8c9-ab76-40d7-93ef-3e4a8270dd76%40siemens.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] initramfs-fsck-hook: bump version, rename package and files
2024-09-06 9:56 ` 'Jan Kiszka' via isar-users
@ 2024-09-07 16:51 ` '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: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
1 sibling, 2 replies; 7+ messages in thread
From: 'Rakesh Kumar' via isar-users @ 2024-09-07 16:51 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, cedric.hombourger, Rakesh Kumar
* Bump initramfs-fsck-hook version from 0.2 to 0.3.
* Renamed package from initramfs-fsck-hook-ext4 to initramfs-fsck-ext4
for better readability.
* Renamed hook and trigger files for better readability.
Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
---
...sck.ext4.hook => initramfs-fsck-ext4.hook} | 0
....triggers => initramfs-fsck-ext4.triggers} | 0
.../initramfs-fsck-ext4_0.3.bb | 20 +++++++++++++++++++
.../initramfs-fsck-hook-ext4_0.2.bb | 18 -----------------
4 files changed, 20 insertions(+), 18 deletions(-)
rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs.fsck.ext4.hook => initramfs-fsck-ext4.hook} (100%)
rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs-fsck-hook-ext4.triggers => initramfs-fsck-ext4.triggers} (100%)
create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
delete mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
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
similarity index 100%
rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.hook
diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers b/meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
similarity index 100%
rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-hook-ext4.triggers
rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
new file mode 100644
index 00000000..de19828c
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
@@ -0,0 +1,20 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+
+DESCRIPTION = "Recipe to add fsck hook to the initramfs"
+
+DEBIAN_DEPENDS = "e2fsprogs,initramfs-tools"
+
+inherit dpkg-raw
+SRC_URI = "file://${PN}.triggers \
+ file://${PN}.hook \
+ "
+
+do_install[cleandirs] += "${D}/etc/initramfs-tools/hooks"
+
+do_install() {
+ install -m 0755 ${WORKDIR}/${PN}.hook ${D}/etc/initramfs-tools/hooks/
+}
diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
deleted file mode 100644
index 9860dbc8..00000000
--- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-
-DESCRIPTION = "Recipe to add fsck hook to the initramfs"
-
-inherit dpkg-raw
-SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
- file://initramfs.fsck.ext4.hook \
- "
-
-
-do_install() {
- install -m 0755 -d ${D}/etc/initramfs-tools/hooks
- install -m 0740 ${WORKDIR}/initramfs.fsck.ext4.hook ${D}/etc/initramfs-tools/hooks/fsck.ext4.hook
-}
--
2.39.2
--
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/20240907165104.1825446-1-kumar.rakesh%40siemens.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] initramfs-fsck-hook: improve error handling and correct fsck path
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 ` 'Rakesh Kumar' via isar-users
2024-09-09 3:13 ` 'cedric.hombourger@siemens.com' via isar-users
2024-09-09 3:15 ` [PATCH 1/2] initramfs-fsck-hook: bump version, rename package and files 'cedric.hombourger@siemens.com' via isar-users
1 sibling, 1 reply; 7+ messages in thread
From: 'Rakesh Kumar' via isar-users @ 2024-09-07 16:51 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, cedric.hombourger, Rakesh Kumar
* Used hook_error() function to improve error handling during
copy_exec calls in the initramfs hook script.
* Corrected the path for fsck from /sbin/fsck to /usr/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"
--
2.39.2
--
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/20240907165104.1825446-2-kumar.rakesh%40siemens.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] initramfs-fsck-hook: version bump to 0.3 and error handling improvement
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:59 ` 'Rakesh Kumar' via isar-users
1 sibling, 0 replies; 7+ messages in thread
From: 'Rakesh Kumar' via isar-users @ 2024-09-07 16:59 UTC (permalink / raw)
To: isar-users; +Cc: Rakesh Kumar
This patch series makes two significant changes to the initramfs-fsck-hook recipe:
1. Bumps the version from 0.2 to 0.3, renames the package, hook and trigger files for better readability.
2. Used better error handling in the hook script by adding the hook_error() function and correcting the path to /usr/sbin/fsck.
Rakesh Kumar (2):
initramfs-fsck-hook: bump version, rename package and files
initramfs-fsck-hook: improve error handling and correct fsck path
...sck.ext4.hook => initramfs-fsck-ext4.hook} | 21 +++++++------------
....triggers => initramfs-fsck-ext4.triggers} | 0
.../initramfs-fsck-ext4_0.3.bb | 20 ++++++++++++++++++
.../initramfs-fsck-hook-ext4_0.2.bb | 18 ----------------
4 files changed, 27 insertions(+), 32 deletions(-)
rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs.fsck.ext4.hook => initramfs-fsck-ext4.hook} (51%)
rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs-fsck-hook-ext4.triggers => initramfs-fsck-ext4.triggers} (100%)
create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-ext4_0.3.bb
delete mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.2.bb
--
2.39.2
--
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/20240907165945.1825602-1-kumar.rakesh%40siemens.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] initramfs-fsck-hook: improve error handling and correct fsck path
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
0 siblings, 0 replies; 7+ messages in thread
From: 'cedric.hombourger@siemens.com' via isar-users @ 2024-09-09 3:13 UTC (permalink / raw)
To: isar-users, Kumar, Rakesh; +Cc: Kiszka, Jan
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] initramfs-fsck-hook: bump version, rename package and files
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:15 ` 'cedric.hombourger@siemens.com' via isar-users
1 sibling, 0 replies; 7+ messages in thread
From: 'cedric.hombourger@siemens.com' via isar-users @ 2024-09-09 3:15 UTC (permalink / raw)
To: isar-users, Kumar, Rakesh; +Cc: Kiszka, Jan
On Sat, 2024-09-07 at 22:21 +0530, Rakesh Kumar wrote:
> * Bump initramfs-fsck-hook version from 0.2 to 0.3.
> * Renamed package from initramfs-fsck-hook-ext4 to initramfs-fsck-
> ext4
> for better readability.
Chances of breaking downstream layers are too high
> * Renamed hook and trigger files for better readability.
>
> Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
> ---
> ...sck.ext4.hook => initramfs-fsck-ext4.hook} | 0
> ....triggers => initramfs-fsck-ext4.triggers} | 0
> .../initramfs-fsck-ext4_0.3.bb | 20
> +++++++++++++++++++
> .../initramfs-fsck-hook-ext4_0.2.bb | 18 -----------------
> 4 files changed, 20 insertions(+), 18 deletions(-)
> rename meta/recipes-support/initramfs-fsck-
> hook/files/{initramfs.fsck.ext4.hook => initramfs-fsck-ext4.hook}
> (100%)
> rename meta/recipes-support/initramfs-fsck-hook/files/{initramfs-
> fsck-hook-ext4.triggers => initramfs-fsck-ext4.triggers} (100%)
> create mode 100644 meta/recipes-support/initramfs-fsck-
> hook/initramfs-fsck-ext4_0.3.bb
> delete mode 100644 meta/recipes-support/initramfs-fsck-
> hook/initramfs-fsck-hook-ext4_0.2.bb
>
> 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
> similarity index 100%
> rename from meta/recipes-support/initramfs-fsck-
> hook/files/initramfs.fsck.ext4.hook
> rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-
> fsck-ext4.hook
> diff --git a/meta/recipes-support/initramfs-fsck-
> hook/files/initramfs-fsck-hook-ext4.triggers b/meta/recipes-
> support/initramfs-fsck-hook/files/initramfs-fsck-ext4.triggers
> similarity index 100%
> rename from meta/recipes-support/initramfs-fsck-hook/files/initramfs-
> fsck-hook-ext4.triggers
> rename to meta/recipes-support/initramfs-fsck-hook/files/initramfs-
> fsck-ext4.triggers
> diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-
> ext4_0.3.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-
> fsck-ext4_0.3.bb
> new file mode 100644
> index 00000000..de19828c
> --- /dev/null
> +++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-
> ext4_0.3.bb
> @@ -0,0 +1,20 @@
> +# This software is a part of ISAR.
> +# Copyright (C) Siemens AG, 2019
> +#
> +# SPDX-License-Identifier: MIT
> +
> +
> +DESCRIPTION = "Recipe to add fsck hook to the initramfs"
> +
> +DEBIAN_DEPENDS = "e2fsprogs,initramfs-tools"
> +
> +inherit dpkg-raw
> +SRC_URI = "file://${PN}.triggers \
> + file://${PN}.hook \
> + "
> +
> +do_install[cleandirs] += "${D}/etc/initramfs-tools/hooks"
> +
> +do_install() {
> + install -m 0755 ${WORKDIR}/${PN}.hook ${D}/etc/initramfs-
> tools/hooks/
> +}
> diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-
> hook-ext4_0.2.bb b/meta/recipes-support/initramfs-fsck-
> hook/initramfs-fsck-hook-ext4_0.2.bb
> deleted file mode 100644
> index 9860dbc8..00000000
> --- a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-
> ext4_0.2.bb
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -# This software is a part of ISAR.
> -# Copyright (C) Siemens AG, 2019
> -#
> -# SPDX-License-Identifier: MIT
> -
> -
> -DESCRIPTION = "Recipe to add fsck hook to the initramfs"
> -
> -inherit dpkg-raw
> -SRC_URI = "file://initramfs-fsck-hook-ext4.triggers \
> - file://initramfs.fsck.ext4.hook \
> - "
> -
> -
> -do_install() {
> - install -m 0755 -d ${D}/etc/initramfs-tools/hooks
> - install -m 0740 ${WORKDIR}/initramfs.fsck.ext4.hook
> ${D}/etc/initramfs-tools/hooks/fsck.ext4.hook
> -}
--
Cedric Hombourger
Siemens AG
www.siemens.com
--
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/79e61ebca511834ae147bc57e5fe8ab293c1b60c.camel%40siemens.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-09-09 3:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox