grml2iso: execute under pipefail
authorMichael Prokop <mika@grml.org>
Fri, 11 Mar 2022 17:25:31 +0000 (18:25 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 11 Mar 2022 17:57:29 +0000 (18:57 +0100)
Quoting from bash(1):

| The return status of a pipeline is the exit status of the last
| command, unless the pipefail option is enabled.  If pipefail is enabled,
| the pipeline's return status is the value of the last (rightmost)
| command to exit  with a  non-zero  status,  or zero if all commands exit
| successfully.

Furthermore, move the "set -e" to the beginning of the file, to ensure
it's active as soon as possible.

While at it, drop trailing whitespace and update ISO name to a more
recent one.

This work was funded by Grml-Forensic.

grml2iso

index b29c4df..3e48688 100755 (executable)
--- a/grml2iso
+++ b/grml2iso
@@ -6,6 +6,8 @@
 # License:       This file is licensed under the GPL v2 or any later version.
 ################################################################################
 
 # License:       This file is licensed under the GPL v2 or any later version.
 ################################################################################
 
+set -e -o pipefail
+
 # make sure we have the sbin directories in our PATH to find grml2usb ootb
 PATH="${PATH}:/sbin:/usr/local/sbin:/usr/sbin"
 
 # make sure we have the sbin directories in our PATH to find grml2usb ootb
 PATH="${PATH}:/sbin:/usr/local/sbin:/usr/sbin"
 
@@ -32,8 +34,6 @@ fi
 # }}}
 
 # helper stuff {{{
 # }}}
 
 # helper stuff {{{
-  set -e
-
   usage() {
     echo >&2 "Usage: $0 [OPTIONS] -o target.iso source1.iso [source2.iso ...]"
     echo >&2 "
   usage() {
     echo >&2 "Usage: $0 [OPTIONS] -o target.iso source1.iso [source2.iso ...]"
     echo >&2 "
@@ -56,7 +56,7 @@ Options:
                          created by mktemp(1).
 
      Examples:
                          created by mktemp(1).
 
      Examples:
-     $0 -s http://192.168.23.42:8000/grml/ -o small.iso grml64-small_2018.12.iso 
+     $0 -s http://192.168.23.42:8000/grml/ -o small.iso grml64-small_2021.07.iso
 
      Will generate a file small.iso which tries to download the squashfs file from
      http://192.168.23.42:8000/grml/ - the squashfs file is placed in the same
 
      Will generate a file small.iso which tries to download the squashfs file from
      http://192.168.23.42:8000/grml/ - the squashfs file is placed in the same