parted -s "${diskpath}" mklabel gpt
parted -s "${diskpath}" mkpart primary 1MiB 2MiB
Isn't "primary" wrong here? It assumes your `mklabel` command used label-type of msdos or dvh. You are using gpt though. In case of gpt "primary" is a label, not a partition type.You can use a descriptive string here instead of "primary" (e.g. "boot partition", or "esp partition").
https://manpages.debian.org/unstable/parted/parted.8.en.html...