diff options
author | Alyssa Ross <alyssa.ross@unikie.com> | 2022-11-10 11:22:19 +0000 |
---|---|---|
committer | Alyssa Ross <alyssa.ross@unikie.com> | 2022-11-11 14:27:07 +0000 |
commit | 1c8b473f048e55e316900ea83abc40fdb3cdd66a (patch) | |
tree | b17f140f6a734b3785d4ac55bbca9c20f0600558 | |
parent | 8e28cc80b14b613247d953c35dc76ef0b864eb33 (diff) | |
download | spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.tar spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.tar.gz spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.tar.bz2 spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.tar.lz spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.tar.xz spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.tar.zst spectrum-1c8b473f048e55e316900ea83abc40fdb3cdd66a.zip |
scripts: fix shellcheck warnings
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com> Message-Id: <20221110112219.459660-1-alyssa.ross@unikie.com> Reviewed-by: Henri Rosten <henri.rosten@unikie.com>
-rwxr-xr-x | scripts/format-uuid.sh | 12 | ||||
-rwxr-xr-x | scripts/make-gpt.sh | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/scripts/format-uuid.sh b/scripts/format-uuid.sh index 6758088..441ed64 100755 --- a/scripts/format-uuid.sh +++ b/scripts/format-uuid.sh @@ -8,12 +8,12 @@ substr () { str=$1 beg=$2 end=$3 - echo $str | cut -c $beg-$end + echo "$str" | cut -c "$beg-$end" } -u1=$(substr $1 1 8) -u2=$(substr $1 9 12) -u3=$(substr $1 13 16) -u4=$(substr $1 17 20) -u5=$(substr $1 21 32) +u1=$(substr "$1" 1 8) +u2=$(substr "$1" 9 12) +u3=$(substr "$1" 13 16) +u4=$(substr "$1" 17 20) +u5=$(substr "$1" 21 32) printf "%s\n" "$u1-$u2-$u3-$u4-$u5" diff --git a/scripts/make-gpt.sh b/scripts/make-gpt.sh index 3215edb..554182f 100755 --- a/scripts/make-gpt.sh +++ b/scripts/make-gpt.sh @@ -23,7 +23,7 @@ sizeMiB() { fillPartition() { sfdisk -J "$1" | jq -r --argjson index "$2" \ '.partitiontable.partitions[$index] | "\(.start) \(.size)"' | - (read start size; + (read -r start size; dd if="$3" of="$1" seek="$start" count="$size" conv=notrunc) } @@ -48,7 +48,7 @@ gptBytes=$TWO_MiB for partition; do sizeMiB="$(sizeMiB "$(partitionPath "$partition")")" table="$table${nl}size=${sizeMiB}MiB,$(awk -f "$scriptsDir/sfdisk-field.awk" -v partition="$partition")" - gptBytes="$(expr "$gptBytes" + "$sizeMiB" \* $ONE_MiB)" + gptBytes="$((gptBytes + sizeMiB * ONE_MiB))" done rm -f "$out" @@ -60,5 +60,5 @@ EOF n=0 for partition; do fillPartition "$out" "$n" "$(partitionPath "$partition")" - n="$(expr "$n" + 1)" + n="$((n + 1))" done |