Skip to content

Commit

Permalink
inject-cmdline-to-template.sh: use -e again
Browse files Browse the repository at this point in the history
Signed-off-by: Norio Nomura <[email protected]>
  • Loading branch information
norio-nomura committed Aug 28, 2024
1 parent eabb683 commit 83c5161
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hack/inject-cmdline-to-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# 6. inject the kernel and initrd location, digest, and cmdline to the template
# 7. output kernel_location, kernel_digest, cmdline, initrd_location, initrd_digest

set -u -o pipefail
set -eu -o pipefail

template="$1"
appending_options="$2"
Expand Down Expand Up @@ -45,6 +45,7 @@ while IFS= read -r line; do arr+=("${line}"); done <<<"${parsed}"
readonly locations=("${arr[@]}")
for ((i = 0; i < ${#locations[@]}; i++)); do
[[ ${locations[i]} != "null" ]] || continue
# shellcheck disable=SC2310
if check_location "${locations[i]}"; then
location=${locations[i]}
index=${i}
Expand Down Expand Up @@ -85,6 +86,7 @@ initrd_location="${location_dirname}/${initrd_basename}"
function inject_to() {
# shellcheck disable=SC2034
local template=$1 arch=$2 index=$3 key=$4 location=$5 digest=$6 cmdline=${7:-} fields=() IFS=,
# shellcheck disable=SC2310
check_location "${location}" || return 0
for field_name in location digest cmdline; do
[[ -z ${!field_name} ]] || fields+=("\"${field_name}\": \"${!field_name}\"")
Expand Down

0 comments on commit 83c5161

Please sign in to comment.