diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-03-21 13:07:56 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-03-21 13:07:56 +0000 |
commit | 048fadd0a4bf8b29227dc67f39363305b84ff29a (patch) | |
tree | d7d871595d7877389f2b83556dc1af9200c6e801 | |
parent | 0186fa7e24a67d1a4a9b3f2a541577c5815acbe4 (diff) | |
download | spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.tar spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.tar.gz spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.tar.bz2 spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.tar.lz spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.tar.xz spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.tar.zst spectrum-048fadd0a4bf8b29227dc67f39363305b84ff29a.zip |
scripts/make-gpt.sh: use more shell arithmetic
Having separate constants for 1 MiB and 2 MiB dates from before I knew that shell arithmetic is POSIX, and so I wanted to save an expr process. Signed-off-by: Alyssa Ross <hi@alyssa.is>
-rwxr-xr-x | scripts/make-gpt.sh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/make-gpt.sh b/scripts/make-gpt.sh index 3d4c663..6931879 100755 --- a/scripts/make-gpt.sh +++ b/scripts/make-gpt.sh @@ -1,13 +1,12 @@ #!/bin/sh -eu # -# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> +# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross <hi@alyssa.is> # SPDX-FileCopyrightText: 2022 Unikie # SPDX-License-Identifier: EUPL-1.2+ # # usage: make-gpt.sh GPT_PATH PATH:PARTTYPE[:PARTUUID[:PARTLABEL]]... ONE_MiB=1048576 -TWO_MiB=2097152 # Prints the number of 1MiB blocks required to store the file named # $1. We use 1MiB blocks because that's what sfdisk uses for @@ -44,7 +43,7 @@ nl=' table="label: gpt" # Keep 1MiB free at the start, and 1MiB free at the end. -gptBytes=$TWO_MiB +gptBytes=$((ONE_MiB * 2)) for partition; do sizeMiB="$(sizeMiB "$(partitionPath "$partition")")" table="$table${nl}size=${sizeMiB}MiB,$(awk -f "$scriptsDir/sfdisk-field.awk" -v partition="$partition")" |